search

Home  >  Q&A  >  body text

javascript - How to write animation effects in react?

How to write animation effects for components in react? For example, for a simple dialog box, I hope that after clicking Cancel, the dialog box will first fade and then disappear.
If you use jquery, it is very simple, first animate({ //Fade CSS}, function(){ //Delete DOM}).

But react, I don’t know how to do it. Could it be that the entire component dom exists, and only a CSS animation is used to switch the display and hide?

Please give me some advice

世界只因有你世界只因有你2850 days ago807

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-18 11:00:34

    In most cases, DOM operations are not required, use React Add-OnsReactCSSTransitionGroup组件或ReactTransitionGroupcomponents:

    • React animation

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-18 11:00:34

    You can reference jq in componentDidMount in the react component and then write the animation

    reply
    0
  • Cancelreply