I am thinking of using react hooks [useReducer, useContext] and context api in place of redux. Having said I want my state to be bit complex in structure. Lets see the structure be as
state = {
key1: true,
key2: {
key3: [],
key4: ''
}
}
The thing that I am clear with is both redux and context api allows me to create complex structure. And in case of react hooks usage I can very well use Provider, Consumer/useContext to let pass my store state value to all my components.
The thing that Redux gives me more is that if any specific key say, key4
, is updated then helps me not to re-render entire app tree using connect function from react-redux
. And this is my query.
How can we make react hooks and context api to not to re-render my entire app which is a major performance bug?