Let's say you do a GET
request to server in componentWillMount and set the result to the state. React will execute componentWillMount,
and put the stuff in the 'then' on the callback queue and go on executing render() whereupon you will get an error since the callback has not yet been executed
and your state is still uninitialized.
SO, check for truthy value of whatever it is you are rendering in render() while trying to render it ie {this.state.comment && <span>this.state.comment</span>}
This repository has been archived by the owner on Dec 28, 2022. It is now read-only.