Using React Context
Hi !!! It’s Samson, It's been a while but here I come again you are about to hear how useContext is very important in react-js.😉
I promise it won’t be a very long article but short and beautiful.
| First what is useContext ?
What are they used for?
In what scenario can we use context
Well, let’s dive right in 😊
What is useContest?
The useContext is a react Hook that provides function components access to the context value for a context object. It: Takes the context object (i.e., the value returned from React. createContext 🤨) as the one argument it accepts. And returns the current context value as given by the nearest context provider of an object, okay more digging to do…
‘Context is a React feature for sharing state between several parent and child components with the help of a provider.
Get Samson Ocran’s stories in your inbox
Join Medium for free to get updates from this writer.
useContext is a hook that lets you easily “hook into” context, thereby accessing shared state.
What are they used for
As said earlier, the useContext hook lets users easily share data across each page without fetching the data with either Axios, etc again.
The useContext hook makes it easy for users when it comes to using API fetch and data transfer
In what scenario can we use context
For example when we are having an API that needs to be shear more than one component in the application.
This is my idea on the useContext hook.






