joshwcomeau / react-flip-move

Effortless animation between DOM changes (eg. list reordering) using the FLIP technique.
http://joshwcomeau.github.io/react-flip-move/examples
MIT License
4.09k stars 258 forks source link

Update gotchas with functional components #245

Closed JPeer264 closed 4 years ago

JPeer264 commented 4 years ago

It does work with functional components if they are used correctly.

const MyComponent = forwardRef((_, ref) => (
    <div ref={ref} />
));
tobilen commented 4 years ago

can you update as well in https://github.com/joshwcomeau/react-flip-move/blob/master/src/FlipMove.js#L733 ?

i'd also like it if you could extend this "gotcha" a bit into a "how to use flip move with functional components" section. at least a small example in the readme, a story in the storybook would be even better, if you're up for it.

JPeer264 commented 4 years ago

@tobilen as a lot of people are using functional components (I guess), I put the usage with functional components right next to the quickstart, to make it more prominent.

JPeer264 commented 4 years ago

Sure, no problem. Just ping me if there is something else to change