Urgent: Invalid Hook Call Error with PrimeReactProvider in Custom Package #3181
Unanswered
fouadgomarkets94
asked this question in
PrimeReact
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am encountering an "Invalid hook call" error when using PrimeReactProvider in a custom private package and integrating it within a target project.
Context:
Package Project:
Contains React components built using PrimeReact components.
Wraps these components with PrimeReactProvider.
Declares primereact, react, and react-dom as peer dependencies.
Target Project:
Integrates the custom package.
Does not directly use PrimeReactProvider but relies on it being initialized within the package.
Steps to Reproduce:
Create a custom package with components using PrimeReact.
Wrap the package components with PrimeReactProvider.
Declare primereact, react, and react-dom as peer dependencies in the package.
Link the package to the target project.
Install primereact, react, and react-dom in the target project.
Use components from the package in the target project.
Expected Behavior:
Components from the package should render correctly in the target project without errors.
Actual Behavior:
Encountering the following error:
Debugging Steps Taken:
Ensured single version of React in both projects.
Used react, react-dom, and primereact as peer dependencies.
Verified no multiple instances of React.
Updated Rollup config to treat primereact as external.
Despite these efforts, the error persists, suggesting an issue with how PrimeReactProvider interacts with multiple environments.
Request:
Need guidance on proper usage of PrimeReactProvider within custom packages to avoid conflicts and the "Invalid hook call" error.
Beta Was this translation helpful? Give feedback.
All reactions