-
I'm getting an error when running the component Previews (compositions and main docs page) on This is almost certainly an issue between react17 and 18 ('useid' is a react18 function), but I have done the advised configuration to upgrade to react18:
However I'm still seeing the error as in the title of this issue. What's going on? EDIT: I'll add that this doesn't happen for all react18 components, only some. It seems to be limited to components using specific components from libraries i'm using. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is because while the component is configured for react18, your env itself is still configured with react17 as its own dependency - the Run Solution
Once this is configured, run Now use this new version of your react18 env and you'll see that both the local dev server and the remote scope (after tag+export of your component with the new env) now render as required. Note EDIT (based on the edit in the question): |
Beta Was this translation helpful? Give feedback.
This is because while the component is configured for react18, your env itself is still configured with react17 as its own dependency - the
teambit.envs/env
environment is currently configured still for react17.Run
bit show <env_component>
to verify that this is the case in the dependencies section of the printout.Solution
So, to update your env fully to be react18-compatible you need to manually update its own dependencies. The best way to currently do that is by adding a variant in the
workspace.jsonc
file of your react18 custom env's workspace, like so: