This is the part 3 of this series in which we are discussing the basic react hooks but most powerful i.e useContext hook. We will discuss the whole concept with live coding example. Watch the video till the end to learn the whole concept of useContext hook effectively.
Learn useEffect hook with Slides and Example | React Hooks Series in 2021
Accepts a context object (the value returned from React.createContext) and returns the current context value for that context. The current context value is determined by the value prop of the nearest MyContext.Provider above the calling component in the tree.
A component calling useContext will always re-render when the context value changes. If re-rendering the component is expensive, you can optimize it by using memoization.