Quantcast
Channel: Javascript – Digital Zoom Studio
Viewing all articles
Browse latest Browse all 15

Redux Javascript update state with multiple nested levels – immutable

$
0
0

The only solution I found is having this in the return statement of the reducer

return {
  ...state
  ,[topic_id]:{
    ...state[topic_id]
    ,matches:[
      ...state[topic_id].matches
      ,subticket
    ]
  }
}
;

If there are other solutions, let me know please.

The state structure looks like this


Viewing all articles
Browse latest Browse all 15

Trending Articles