reactjs - Rendering React Ajax with proper child access -
i don't see why 1 works , other doesn't hoping can shed rays of light.
that is:
*some component constructor this.state = { datatransform: '' }; render(){ if (this.state.datatransform === ''){ return null; } else { return ( <chart config={this.state.datatransform}/> ); } }
vs https://facebook.github.io/react/blog/2014/07/17/react-v0.11.html#rendering-to-null no initialization of datatransform or undefined
render(){ if (!this.state.datatransform){ return null; } else { return ( <chart config={this.state.datatransform}/> ); } }
this 1 return error unable read property of datatransform of null until request done , state updated.yet, top 1 works no problem no error messages while performing request.
though react example https://facebook.github.io/react/tips/initial-ajax.html loads within same component want remain stateless , let parents work
Comments
Post a Comment