Will hooks overthrown redux?

百般思念 提交于 2019-12-01 00:11:09

Nope, definitely not.

I addressed this in my Reactathon 2019 talk on "The State of Redux".

Summarizing: hooks mostly offer ways to do the same kinds of things you could already do, like local component state and avoiding prop-drilling via context. If that's all you were using Redux for, then you probably didn't need Redux in the first place. But, hooks have their limitations, and there's lots of additional use cases for choosing Redux.

Also, note that we are currently working on designing a public useRedux()-type hooks API for React-Redux.

It's really hard to say at this time. The redux team is actively updating the product to include some nice features. However, one of the creators of redux (https://github.com/acdlite) seems to be on a path to destroy his old applications in favour of new features in react.

That being said, Redux is a tested and known library that a lot of people are comfortable with. I do not believe it a bad idea to start a new project with redux Today, tomorrow, or in a year. Tech does not die overnight. if it serves a purpose it's going to live on.

However, I do think context and hooks are a great alternative to redux, but the community simply does not know how to use it yet.

In my experience, developers tend to abuse Redux. In most cases you won't need Redux, most of the things can be achieved with Context/Render props/Hooks. When asking a question "do I need redux here?", first ask "can it be done without redux?".

Redux is a great tool, but only when you actually need it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!