简体   繁体   English

没有TransitionGroup组件,演示无法正常工作

[英]without TransitionGroup component, demo dosen't work

I use react-transition-group in my project. 我在我的项目中使用react-transition-group。 The whole project works well so far,but there is something confused me. 到目前为止,整个项目都运行良好,但是有一些令我困惑的地方。 The animation of the project dosen't work without TransitionGroup. 没有TransitionGroup,该项目的动画无法正常工作。

ReactDOM.render(
  <TransitionGroup>
    <CSSTransition
      appear={true}
      classNames="appAppear"
      timeout={500}
    >
      <App/>
    </CSSTransition>
  </TransitionGroup>,
  document.getElementById('root')
);

The document said 'The component manages a set of components in a list.' 该文件说:“组件管理列表中的一组组件。” I still don't know why this hanppen. 我仍然不知道为什么会这样。 Can someone tell me ??? 有人可以告诉我吗?

TransitionGroup manages timed mounting and un-mounting of components, which allows animations to start/end before mounting/un-mounting them. TransitionGroup管理组件的定时安装和卸载,这允许动画在安装/卸载之前开始/结束动画。 Whereas CSSTransition manages classnames based on current mount state like appear, enter, done, etc). 而CSSTransition根据当前的安装状态(如出现,输入,完成等)管理类名。

If you want to know how each of these components work, take a look at their source code: 如果您想了解每个组件的工作方式,请查看它们的源代码:

https://github.com/reactjs/react-transition-group/blob/master/src/TransitionGroup.js https://github.com/reactjs/react-transition-group/blob/master/src/TransitionGroup.js

https://github.com/reactjs/react-transition-group/blob/master/src/CSSTransition.js https://github.com/reactjs/react-transition-group/blob/master/src/CSSTransition.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM