1
リアクショントランジショングループ-v2とリアクションルータ-v4を使用して入力時に子ノードをアニメーション化するにはどうすればよいですか?たとえば、3つの子divノードを含むAboutコンポーネントがあります。リアクショントランジショングループv2を使用したルートアニメーショントランジション
class About extends React.Component {
render() {
return (
<div>
<div>About</div>
<div>About</div>
<div>About</div>
</div>
);
}
}
<div>About</div>
のすべての遷移をアニメーション化する方法。私は
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>
)}
/>
に<Route path="/about" component={About} />
を交換するtridedてきた。しかし、私は、各<div>
にコールバックをフォーカス取得時に追加する方法を理解することはできません。 例:https://codesandbox.io/s/n0566q62lj
componentDidMountを試してみてください。この例では、少し混乱に見えると思います。私はページに入ると全くアニメーション化しません。私は、https://codesandbox.io/s/y2xmwk86ojより明白な例に書き直しました。私は 'componentDidMount'関数を削除しました。 – newguy