Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question