Comrades, I ask for help!

There was such a problem in the formation of the structure of the reducer and the state as a whole.

Take, for example, adding news to the site: The news has immediate data - the title, content (content), metadata.

But the news also has pictures, tags, categories.

It is clear that the site in addition to the news will be a bunch of entities.

And here the question arises - to divide the reducer as much as possible (news, uploads, categories, tags) and then collect all this in a component from different parts, but everything is nice and structured, or make a reducer for the news and include all these fields in it right away. bother, then collecting everything from one part of the state.

Tell me how to do more often. How is more correct? I know it quite recently with the reactor and the redox, so it’s difficult to somehow decide for yourself.

  • This question arose because of the desire for order and proper design, for example, as in databases. And is it really worth comparing these things at all? - Alexey Shipilov
  • And you try to arrange everything in one field - maybe it will be convenient for you. For example, I am not comfortable when there is a deep nesting. - YozhEzhi pm
  • I just ran into such a moment that if everything is assembled in one reducer, then when updating the state there is no heap of re-rendering the component, and if I first updated news, then uploads, then categories — well, this is at least 3. - Alexey Shipilov
  • I can't imagine a case in which the division of the whole news entity into separate text, uploads, categories, tags would make sense. Received a newsItem object with these fields, updated the state. What is the point of separating the loading of a picture and a text on the level of a global state? - Alexandr Tovmach

0