J
J
Joseph Kopeikin2020-09-26 10:07:05
React
Joseph Kopeikin, 2020-09-26 10:07:05

How to merge nested reducers?

I'm trying to make the structure of the store like this

{
  appName: "Вложенные редьюсеры",
  fruits: {
    apples: [
      { id: 0, name: "apple1", saved: true },
      { id: 1, name: "apple2", saved: true }
    ],
    oranges: [
      { id: 0, name: "orange1", saved: true },
      { id: 1, name: "orange2", saved: true }
    ],
    loaded: false,
    saved: true
  }
}

At the same time, it is necessary that a reducer is responsible for each entity.
I am attaching the source code: https://stackblitz.com/edit/react-redux-ts-nested-...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question