When animating an element in React, we can use a fragment, for example:
<div> <button onClick={this.handleAdd}>Add Item</button> <ReactCSSTransitionGroup transitionName="example" transitionEnterTimeout={500} transitionLeaveTimeout={300}> {items} </ReactCSSTransitionGroup> </div>
Along with compliments to css animations.
I read the docs (found here: https://facebook.imtqy.com/react/docs/animation.html)but I'm not 100% sure what the two timeout attributes actually do? is it dangerous to assume and say that they are backup if the animation is not completed?
Should the values ββmatch css in / out duration values ββor should there be more animation values?
.example-enter { opacity: 0.01; } .example-enter.example-enter-active { opacity: 1; transition: opacity 500ms ease-in; } .example-leave { opacity: 1; } .example-leave.example-leave-active { opacity: 0.01; transition: opacity 300ms ease-in; }
javascript reactjs
Chris
source share