props를 깊게 위치한 컴포넌트에 전달할 때 불편할 수 있다
→ passing props 대안책
→ props drilling을 해결
To pass context:
Create and export it with export const MyContext = createContext(defaultValue)
.
Pass it to the useContext(MyContext)
Hook to read it in any child component, no matter how deep.
Wrap children into <MyContext.Provider value={...}>
to provide it from a parent.
Before you use context:
try passing props or passing JSX as children
.