react-animate-mount icon indicating copy to clipboard operation
react-animate-mount copied to clipboard

Readme improvement suggestion: different key prop required to trigger normal react re-render behavior

Open timotgl opened this issue 4 years ago • 0 comments

Following scenario:

<AnimateGroup>
  {data.map((item) => {
    return (
      <SomeComponent
        key={item.id}
        item={item}
      />
    );
  }}
)}
</AnimateGroup>

This is JSX from a function component in our codebase. item is an object with a string property inside. This property is changed through a graphql subscription in our code. It appears that AnimateGroup blocks the re-render of SomeComponent unless the key prop is actually different. Regular React behavior is to re-render the component if a property inside item is changed (we tested with and without using AnimateGroup).

I don't know if this potentially a bug or intended behavior, but maybe the README could put more emphasis on the fact that a different key prop is required to let the content of an AnimateGroup re-render.

timotgl avatar Sep 01 '20 13:09 timotgl