How can I animate child nodes on enter using react-transition-group-v2 and react-router-v4? For example we have About component that include 3 child div nodes.
class About extends React.Component {
render() {
return (
<div>
<div>About</div>
<div>About</div>
<div>About</div>
</div>
);
}
}
How to animate transition of every single <div>About</div>. I've trided to replace <Route path="/about" component={About} /> on
function FirstChild(props) {
const childrenArray = React.Children.toArray(props.children);
return childrenArray[0] || null;
}
...
<Route path="/about"
children={({ match, ...rest }) => (
<TransitionGroup component={FirstChild}>
{match && <About {...rest} />}
</TransitionGroup>
)}
/>
But I cannot understand how to add onEnter callback to each <div>.
Example: https://codesandbox.io/s/n0566q62lj