I have one big object stored on my store holds the API response, whenever I change one change in this object it updates all the components attached to this object and I need it to only update the component that is attached to this only prop not all of them, how can I do that? I thought by using Immer it will resolve my issue but it didn't?

1 Answers

Bankim Sutaria On Best Solutions

There are multiple ways you can resolve this issue:

1) You can use shouldComponentUpdate lifecycle hooks and check for that used props with previous and current props and controlled render based on values.

2)You can use React.PureComponent instead of React.Component

Please check React Documentation for implementation of above mention features.