react-d3-treemap
react-d3-treemap copied to clipboard
Lazy loading children
Hi, Is there anyway I can lazily load children when user clicks on a tile?
Hi @pankajvishwani , Please could you explain your question little bit more. Not sure what you mean with lazily load children.. Lazy load the data for this children ?
Referring to "src/data/data.ts" file, I have data that looks something like this:
const data = {
name: "flare",
children: [
{ name: "analytics", hasChildren: true },
{ name: "animater", hasChildren: true}
]
}
Now, when user clicks on analytics, that's when I want to make a request to get it's children.
Hi @pankajvishwani , This component was designed to load the whole data structure initially. The reason is to be more responsive for the user perspective.
However, PR is accepted with some changes for Async approach as far the normal approach continue working.
Good feedback, really appreciated.
Hey @pankajvishwani, I'm also trying to accomplish the same thing. Currently considering an async function that updates the tree data and to call this function when a node is clicked (and has children). Just curious as to what your solution was to load child nodes on demand.