L
L
laguna11322018-03-02 13:13:20
JavaScript
laguna1132, 2018-03-02 13:13:20

What is imutable data for in React?

I am learning React and Redux. I got to the point of using immutable data, but I can't figure out what they are for. In particular, the imutable.js library.
I understood the following things: connect picks up changes in the store and is updated only when the data in the store has become new, and not mutated. Well, ok, what's the problem in the reducer on a certain ActionCreator to return a new object/array of data?
Why make data immutable? Why use imutable.js? Where is the profit? Explain, please, in more detail. I do not quite understand such an answer as "Less headache."
Thank you very much, all the best :3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2018-03-02
@laguna1132

No profit, don't bother.
When the "profit" from immutable looms on the horizon, you will be ready for this (either you will encounter some kind of problem and enter the immutable, or simply increase the theoretical base / complexity of the task). As far as I understand, using immutable and not using .toJS() - lookups in your data structure will be faster.
ps if I find a video I'll add it, there was a presentation. not yet found.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question