I
I
Ilya Soldatenkov2019-04-29 17:46:38
React
Ilya Soldatenkov, 2019-04-29 17:46:38

How to track state changes?

Let's say I have three fields in the state, one is the amount, another is the discount, and the third is the result. And now let's say that there are 10 fields and they change in different places and at different times.
The question is this - is there a way for the resulting field to "watch" for changes in the required fields in order to construct its value from them. A similar analogue is controlled components, so I would also like to do it with the desired field in the state.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-04-29
@wrqqq

It is better not to store the resulting fields at all, but to count the values ​​after the fact.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question