Clicking the button internally calls this.render()
, but that's not what actually causes the rendering to happen (you can see this in action because the text created by {Math.random()}
doesn't change). However, if I simply call this.setState()
instead of this.render()
, it works fine.
So I guess my question is: do React components need to have state in order to rerender? Is there a way to force the component to update on demand without changing the state?