reactjs - Render React elements on different points -


how can render 2 react elements share props in 2 different part of page?

i need because don't want render every part of page react, elements in <header /> share props <footer />

example:

<body>    <headerreactelement />    tons of html code    <footerreactelement />  </body>

thanks

when instantiate header/footer element, pass in props. there's no reason not reuse exact same props.

if data change, props should have callback function header , footer can listen , force re-render.

  //example listen changes   componentwillmount: function(){     this.callback = (function(){       this.forceupdate();     }).bind(this);     this.props.on('change',this.callback);   }, 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -