Falling in Love with ReactJS
TIL, ReactJS docs are really good and I am starting to get a better hang of how hooks really work.
useContext
The most important thing in daily life of a ReactJS developer maybe the context providers.
NextJS provides them pre written and ready to use. But when I tried to understand them.
Man oh man, they are simply really good.
createContext
allows to make the parameters for the context provider.
This thing solves the problem of prop-drilling. Any ReactJS developer may tell you that how it is a pain in the ๐.
useContext
allows you to pass the context in the top most file and use it anywhere.
Damnnnn!!!!!
Now I know why everyone loves React ecosystem.
Resources:
Prop-drilling=>
https://react.dev/learn/passing-data-deeply-with-context
useContext=> https://react.dev/reference/react/useContext
Subscribe to my newsletter
Read articles from Saksham Gupta directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Saksham Gupta
Saksham Gupta
Web Developer and Content Creator