javascript - Fading a component in and fading another one out React.js -


i started getting using react.js , make easier myself i'm trying recreate projects i've made in past, instead of using jquery did in past i'm avoiding jquery , using react.

i tend animations div fade in fades out this:

$("#start").click(function() {     $("#h1").fadeout(750);     $("#h2").delay(500).fadein(750);     $("#h1").css("z-index", 0);     $("#h2").css("z-index", 1); });  

i wondering how can reproduce fade in , out effect without jquery

(i know css animations change opacity, opacity isn't thing i'm trying change, affects display property well).

one option use framework, react-bootstrap, includes lot of ui components need given project. includes fade component. documentation can found here: https://react-bootstrap.github.io/components.html#utilities

class example extends react.component {   constructor(...args) {   super(...args);   this.state = {};  }   render() {   return (     <div>       <button onclick={()=> this.setstate({ open: !this.state.open })}>        click       </button>       <fade in={this.state.open}>         <div>           content fade           </well>         </div>       </fade>     </div>   );  } }  reactdom.render(<example/>, mountnode); 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -