I’m trying datacore. I don’t know JavaScript or react, so I’m hacking.
I can’t find any code examples for returning a list of list items or tasks. Only returning pages.
Return pages example
E.g. All notes containing “#s”:
```datacorejsx
return function View() {
const pages = dc.useQuery('@page and #s');
return <dc.List rows={pages} renderer={pages => pages.$link} />;
}
```
…works perfectly. And it’s such simple code, I had high hopes that I could just swap out a term or two…
Return list-items or tasks, how?
But if I replace @page with other types (@list-item or @task) then I get a list of double bullet points, with no visible text or links. It’s about the right length of list though.
From Datacore’s queries and list views descriptions, it seems that this is one way to return the lists items from all notes tagged #s:
return function View() {
const items = dc.useQuery('@list-item and childof(@page and #s)');
return <dc.List rows={items} />;
}
Forum posts about Datacore get little traction as of yet, but your question got me to finally take a look at the docs. I’ve not used Datacore, don’t know JavaScript, and am happy to be schooled about any known better practices than this one.
Unlike page, list-item has no $link property, that is why you are getting list of empty items. You could just remove renderer i.e. return <dc.List rows={pages} />; to make it work.