the documentation says. All React components should act as pure functions in relation to their details. https://facebook.imtqy.com/react/docs/components-and-props.html but does not explain the true reason for this, why?
I would say due to tracking component state changes. If it is not clean, it can cause side effects every time it is performed. Thus, it would be very difficult to find out what has changed and, moreover, how to respond to these changes.
, , . , - , .
, /, .
, : A B, A - B. A , - . B, , B A, .
- , , , B . , , . , , , , , . , . , .
https://facebook.imtqy.com/react/blog/2015/02/24/streamlining-react-elements.html#problem-mutating-props-you-dont-own
React , , render props state, render .
render
props
state
, , , React , DOM , . , . ? .
, - . , DOM , - , . React , , DOM, . , , , , , - .
h 8, f, h f, c, f c ...
h
f
c
- , React . , . c, a b. c f, e g. , , .
a
b
e
g
, , React , , , , , . React .
"" .
, , .
, , React, , .
Posting the answer here will be too much for the message and unnecessary because it has already explained to React Team. That is why I prefer to give you the source directly.
Source: https://habr.com/ru/post/1668549/More articles:Order InvokeAsync - multithreadingCopy and paste termux into the terminal: float - terminalMomentjs instant object and offset - javascriptGet the nth element from an array of VBA strings - arraysТа же математическая логика, разные результаты? - sqlНевозможно прочитать свойство undefined angular2 ngif - javascriptOrder reliability InvokeAsync - c #How to add a link to an Azure Function C # project? - c #How to get full log for bean shell scripts in jmeter - loggingInvalid signature length when calling PGPOnePassSignature.verify - javaAll Articles