Home > Web Front-end > Front-end Q&A > What are the principles that react follows?

What are the principles that react follows?

王林
Release: 2020-11-20 11:57:22
Original
3157 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template