3 ms·
What about the built-in Context api ?
by sandGorgon 7y ago
What about the built-in Context api ?
- acemarke 7y agoContext is a useful tool, but its only purpose is to make value accessible to deeply nested components. It's not even a state management tool - you have to manage whatever state you want to put into that context, by yourself. The useState and useReducer hooks start to resemble Redux a bit more when used together with context, but they definitely do not replace Redux. For more details, see these posts : - https://daveceddia.com/context-api-vs-redux/ https://daveceddia.com/context-api-vs-redux/ - https://www.simplethread.com/cant-replace-redux-with-hooks/ https://www.simplethread.com/cant-replace-redux-with-hooks/ - https://staleclosures.dev/from-redux-to-hooks-case-study/ https://staleclosures.dev/from-redux-to-hooks-case-study/ - https://medium.com/javascript-scene/do-react-hooks-replace-redux-210bab340672 https://medium.com/javascript-scene/do-react-hooks-replace-r... - https://dev.to/chrisachard/can-you-replace-redux-with-react-hooks-20gm https://dev.to/chrisachard/can-you-replace-redux-with-react-...
- zabana 7y agoAbsolutely. For most projects it is more than enough. If you have a basic CRUD app with token authentication you can get away with using that. There has been better form support thanks to new libraries coming out recently so I don't see reason to learn redux is, as was pointed out by other commenters, very verbose and requires a lot of boilerplate code to get started. The context API is baked in, no external lib required. If you can afford to update your react codebase to the latest version without major breaking changes I would totally migrate to the context API.