How to do animation in react, simple, pop-up box change opacity gradually display

background:

<div 
    className="company-detail"
    style={{display:this.state.cd_show ? "block" : "none"}}
>
    ...
</div>

this is a pop-up window
used to change the state control display, as above; now 1. I think it"s too stiff. When you click on a different nodes, the content in the pop-up window is adjusted to get the interface, and the user can see the changing process of the content.
question:
to sum up, now you want to make it overdisplay when the pop-up window is displayed (opacity from 0 to 1), and you can just display:none when you hide it.

Mar.23,2021

there are 2 simple methods:

  1. use Animation Add-Ons, official document .
  2. make use of the CSS3 attribute: transition:all .2s ease; (recommended, simple and rude)
.comp {
    opacity: 0;
    transition:all .2s ease;
    &.show {
        opacity: 1;
    }
}
Menu