-
Hi 👋, The docs don't include any specific info about Next.js 13 and the app router.
Can I make this work? |
Beta Was this translation helpful? Give feedback.
Answered by
mrboen94
Oct 5, 2023
Replies: 1 comment 2 replies
-
You can make this work by placing "use client" at the top of the file you are using createContext in. I had the same problem, but the error message does indeed describe the solution. "use client"
import React from "react";
// etc ... |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You usually need to use it if you have an
onClick
or similar in your component. For debugging you should be able to set it as far up the tree as possible, then move down through the files. It probably comes from one of the click events on the CH components.Regardless this is probably a chat you'd want to take with the Next team or the NextJs discord: https://discord.com/invite/nextjs as it is not necessarily a problem with code-hike, but just a quirk of using NextJs.
For reference I have used it in this repo for a test project I did: https://github.com/mrboen94/Haiku/blob/5e91798816508a9cb393c0f7b7de706f1996c5f2/haiku/app/page.tsx#L1
However that project does not use code-hike, but it sh…