DEV Community

Discussion on: Creating your own mini-Redux - with React Hooks, Context API and TypeScript

Collapse
 
pengeszikra profile image
Peter Vivo

If we would like keep our code simple ass possible, why need to use context API? In my view that is just over complicate the code vs simple useReducer.

Collapse
 
qaismakani profile image
Qais Makani

useReducer and Context API are independent concepts. They're used in conjunction here to get redux-like functionality.

The Context API was introduced to avoid "prop drilling" in react. Earlier, it was only possible using redux.

Here's a link explaining what prop drilling is:
kentcdodds.com/blog/prop-drilling/