Home  >  Article  >  Web Front-end  >  What are the principles that react follows?

What are the principles that react follows?

王林
王林Original
2020-11-20 11:57:223148browse

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.

What are the principles that react follows?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn