EmoLogic Factory Tylor's Blog

How to choose Redux state vs React Component state?

Background

Redux is used for saving the states of the javascript app. For years, I’ve liked it pretty much.
But I’ve experienced that sometimes it can be a burden for both application itself and developer too.

Below are the frequent complains I’ve made.

Of course, you can minimize the ‘component update’ by making and connect reducers wisely. Though, I don’t think it’s easier than React’s component state.

I wanted to use React’s component states for tiny component states to avoid complexity and getting performance enhancement.

It works well for a while, but it became mess soon too.
So I had to make some guideline or criteria for choosing a proper state handler.

Criteria

If a new state doesn’t have any of them, I think of React component states will be the better idea.

Ref and More thoughts

React Context API will be game changer. However, I prefer to use Redux as I used before until now.

comments powered by Disqus