[React] Rendering <Context> directly is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?

삔아·2023년 5월 3일
0
post-thumbnail

문제 상황

Rendering <Context> directly is not supported and will be removed in a future major release.
Did you mean to render <Context.Consumer> instead?

해결

  • 해결 전
import AuthContextProvider from "./store/auth-context";
  • 해결 후
import { AuthContextProvider } from "./store/auth-context";

에러 난 이유

export default AuthContextProvider 를 하지 않았기 때문에 해결 전의 코드 처럼 import 하면 안된다.


const AuthContext = () => {
	...
};

export const AuthContextProvider = (props) => {
	...
}

export default AuthContext;
profile
Frontend 개발자 입니다, 피드백은 언제나 환영 입니다

0개의 댓글