I'm happy to move this question elsewhere if you can point me in the right direction.
Why do I get an error (Uncaught TypeError: Cannot read property 'someProperty' of null) when I don't call this.setState() before the initial render?
render() {
return (
<span>{this.state.someProperty}</span>
)
}
This error goes away if I simply call this.setState() with an empty object in componentWillMount:
componentWillMount() {
this.setState({});
}
Isn't this.state part of the core React Component API? Why wouldn't it be present by default?