StreakYC / react-draggable-list

React component for a list of draggable collapsible items
MIT License
319 stars 48 forks source link

react hooks support? #35

Open cesarquiroz opened 4 years ago

cesarquiroz commented 4 years ago

is there any plan to support functional programming and React hooks for this component? I really want to use it, and we made it work with us implementing React hooks, but now we are getting a warning in the console:

image

and is happening because of this section of code:

image

Plus this causes another warning:

image

because the template item is not being rendered with a unique key.

Thanks

Macil commented 4 years ago

Currently the template component must be a class-based React component. In the future, I plan on making it so DraggableList follows a render-props pattern instead of taking in a component as a prop, which will avoid this issue of requiring a class-based React component, and will solve some issues inherent to taking a component as a prop.

cesarquiroz commented 4 years ago

ok thanks!! :)

DanielChen93 commented 1 year ago

Hi @Macil , can current version support functional component as the template component?

wegry commented 6 months ago

can current version support functional component as the template component?

@DanielChen93 as of react-draggable-list@4.0.2, the answer seems to be no.