Tips and tricks

Redux Javascript update state with multiple nested levels - immutable

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

Leave a comment

Your email address will not be published

{"type":"main_options","images_arr":"'#ffffff'","bg_slideshow_time":"0","site_url":"https:\/\/digitalzoomstudio.net","theme_url":"https:\/\/digitalzoomstudio.net\/wp-content\/themes\/qucreative\/","is_customize_preview":"off","gallery_w_thumbs_autoplay_videos":"off","base_url":"https:\/\/digitalzoomstudio.net"}