Home > Article > Web Front-end > What are the principles that react follows?
The principles followed by react are: 1. Single source of truth; 2. State is read-only; 3. Use pure functions to make changes. A single state tree makes it easier to track changes over time and debug or inspect the application.
The principles followed by react are:
(Learning video sharing: css video tutorial)
1. Single source of truth
The state of the entire application is stored in an object/state tree in a single store. A single state tree makes it easier to track changes over time and debug or inspect the application.
2. The status is read-only.
The only way to change the status is to trigger an action. Actions are ordinary JS objects that describe changes. Just like state is the minimal representation of the data, the operation is the minimal representation of the change to the data.
3. Use pure functions to make changes
In order to specify how the state tree is transformed by operations, you need pure functions. Pure functions are those whose return value depends only on the values of its arguments.
Related recommendations: CSS tutorial
The above is the detailed content of What are the principles that react follows?. For more information, please follow other related articles on the PHP Chinese website!