States are the source of data for React components. In other words, they are objects responsible for determining components behavior and rendering. As such, they must be kept as simple as possible.
Accessible by means of this.state(), state is mutable and creates dynamic and interactive components. Use of a state can be visualized by the following code snippet:
1 2 3 4 5 6 7 | class App extends React.Component { constructor() { super(); this.state={ foo: 'bar' } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.