D
D
Dmitry2016-05-22 14:37:23
JavaScript
Dmitry, 2016-05-22 14:37:23

How to fade in and out in React?

Good afternoon.
I'm scratching my head on how to make a notification fade in and out in React.
I suspect that you need to play around with the lifecycle functions of the component, like componentDidMount and componentWillUnmount, but I can’t fully understand.
Maybe when inserting a component into the DOM, give the class opacity: 0, and then set the setState({ visibility: true }) timer in componentDidMount and style={ this.state.visibility in the component? { opacity: 1 } : { opacity: 0 } } ?
Or maybe directly from componentDidMount there is access to the element to directly assign opacity?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Deodatuss, 2016-05-22
@Deodatuss

you can see how it is done here

A
Aves, 2016-05-22
@Aves

https://facebook.github.io/react/docs/animation.ht...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question