Animated grid responsive to width changes.
- Width aware animated reordering elements
npm i react-spring-animated-grid
import { GridComponent } from 'react-spring-animated-grid'
...
<GridComponent itemMarginRight={10} style={{ width: "300px" }}>
{elements.map((e, i) => (
<div
className="item"
key={e.text}
onClick={() => toggleClicked(e.text)}
>
{!isClicked(e.text) && e.text}
</div>
))}
</GridComponent>
https://codesandbox.io/s/animated-grid-demo-ycu8x?file=/src/App.js:793-814