Open raphox opened 7 months ago
Thank your feed-back, Are u wrapping component like this on top or something else?
https://www.npmjs.com/package/serif-ui-components
i'm trying my package its work on next-js (v14 app router)
Hi,
I am using a page router. My goal is to create an SPA using the Next pages router.
I tried to use the useCallback
using the page route and it wasn't render. Before it, after reading other posts, I already tried to use the createContext
wrapping my component without success, too.
I am forking your project to check if using the useEffect
inside your Button
component in a page router project is possible.
During my research I read somewhere that in order to use the component to be rendered on the client side, I would have to import the component's original file by fetching it from within node_modules. But this seemed strange to me and I didn't understand the best way to expose the file from within my package.
I solved my issue.
I was installing my package from my local environment using: "metacomet-ui-components": "file:../metacomet-ui-components",
.
Now I am using npm link
. You can find more info here https://docs.npmjs.com/cli/commands/npm-link
I didn't try to use it from an npm remote repository, but I hope to have the same behavior as the npm link.
Thank you @serifcolakel
Sorry, @serifcolakel, I haven't solved it yet.
After changing my component library, I didn't know I needed to execute the command npm link metacomet-ui-components
again.
After linking and getting the message changed 1 package, ...
the exception persists 😞.
There seems to be an error with the npm link
and React hooks.
https://medium.com/bbc-product-technology/solving-the-problem-with-npm-link-and-react-hooks-266c832dd019
When I am trying to import a component from my custom library in a Next 14 project, I am getting the following exception:
My current code is:
My custom component extends the https://ui.shadcn.com/ and the problem is related to the uses of the method React.useEffect.
The message printed in the console is:
My collected infos:
peerDependencies
to prevent this, but it seems to be not working.use client
notation to fix it without success.