minop1205 / react-dnd-treeview

A draggable / droppable React-based treeview component. You can use render props to create each node freely.
MIT License
531 stars 71 forks source link

Add multiple new node at once. #209

Closed nilesh2b closed 6 months ago

nilesh2b commented 1 year ago

@minop1205 I have been using this package from very long time and found very useful.

Can we add multiple nodes using dropdown list of nodes which will come from an API in the popup box of add new node?

minop1205 commented 1 year ago

@nilesh2b Yes, it is possible. No special method is needed, it should be possible by simply passing a new array to the tree property.

How you merge tree items is up to your application.

const newItems = [...oldItems, ...newItems];

<Tree tree={newItems} {. .otherProps} /> 
nilesh2b commented 1 year ago

@minop1205 Thanks again. I will apply this method and check.