What are the best ways to prevent duplication with Redux?

If you are using Redux and you have an array in state, but you want duplicate elements not to fall into this array, shouldn't duplicates be added to the array in the reducer or is this what should be done in the action creator?

+4
source share
1 answer

In general, the creators of a Redux action should avoid knowing anything about the state of the application, as Redux author Dan Abramov describes :

In a shared state in action, creators are an anti-pattern, and you should avoid this whenever possible.

Redux , , , - , , . , "- ", " "; , , .

, , , .

, , , , , "".

+3

Source: https://habr.com/ru/post/1657810/


All Articles