Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于react-transition-group的一些问题 #120

Open
XYH1996 opened this issue Jan 2, 2020 · 0 comments
Open

关于react-transition-group的一些问题 #120

XYH1996 opened this issue Jan 2, 2020 · 0 comments

Comments

@XYH1996
Copy link

XYH1996 commented Jan 2, 2020

204页讲到的TransitionGroup要发挥作用必须自身已经完成装载
todoList的render函数:

  <TransitionGroup transitionName="fade" transitionEnterTimeout={500} transitionLeaveTimeout={200}>
{
  todos.map((item) => (
    <TodoItem
      key={item.id}
      id={item.id}
      text={item.text}
      completed={item.completed}
    />
    ))
}
  </TransitionGroup>
</ul>

那么TransitionGroup完成装载(componentDidMount)的时候,todoItem肯定已经先于此方法被装载了,而之后该组件才完成装载,这与书上说的完全装载才能发挥作用,不是矛盾了么?

我自己在todoItem里面实现了205页所说的在todoItem里面使用的情况发现也是会有动画的,render函数如下:

<CSSTransition key={id} timeout={500} classNames="item" > <li> do something </li> </CSSTransition>
望老师解答

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant