next14

    Next.js v14 Error : createContext in a Server Component

    Server Error Error: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component 원인 : 클라이언트 컴포넌트에서만 사용가능한 createContext를 사용해서 생긴 에러. 컴포넌트가 있는 파일 최상단에 'use client'를 쓰면 해결되다고 한다. 그러나, metadata를 export 하고 있었기 때문에 관련 파일들을 client 모듈로 선언할 수 없었다. 'use client'를 선언할 경우 선언 아래로 실행되는 컴포..