DEV Community

Discussion on: How To Immutably Update An Array In TypeScript

Collapse
 
shelob9 profile image
Josh Pollock

That example is massively over simplified, I can see why it's confusing. In my case it does need to be decoupled from the component as the state is shared in multiple components. Also, state management is shared with parts of the page that are not created with React.

Yes, what you show works for adding an item. It would still need an updater method.