커리어리 트렌드
일 년 전 · 우엉김밥 님의 새로운 댓글
리액트 context api
* ContextProvider 정의* const LocationContext = createContext() export const LocationProvider = ({children})=> return ( <LocationContext.Provider value={contextValue}> {children} </LocationContext.Provider> ); }; --------------------------- asd.jsx <ContextProvider> <A/> </ContextProvider> ---------------------- qwe.jsx <ContextProvider> <B/> </ContextProvider> ---------------------------------- 이런식으로 작성했을때 A컴포넌트에서 컨택스트 내부 값을 변경하면 B컴포넌트가 재 랜더링 되나요? (되는줄 알았는데 안돼서요..ㅠ)
개발자
#react
#context
답변 1
댓글 1
조회 52