Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anyone getting this error? 'CheckboxTree' cannot be used as a JSX component #502

Open
ariscruz opened this issue May 24, 2024 · 1 comment

Comments

@ariscruz
Copy link

Full error:
'CheckboxTree' cannot be used as a JSX component.
Its instance type 'CheckboxTree' is not a valid JSX element.
The types returned by 'render()' are incompatible between these types.
Type 'React.ReactNode' is not assignable to type 'import
Type '{}' is not assignable to type 'ReactNode'

Some details:
react-checkbox-tree: "1.8.0"
react: "^17.0.2"
react-dom: "^17.0.2"
react-types: "^17.0.37"

We're using yarn to build.
Tried to downgrade react-checkbox-tree to "1.7.3" but same error.

Have looked into adding a resolutions for @types/react to 17 (similar to this: facebook/react#24304 (comment)), did a cleanup of node_modules and then yarn install but error still persists

Updating to react18 is not an option yet.
Appreciate your help. Thanks

@ariscruz
Copy link
Author

ariscruz commented May 24, 2024

Able to solve the error by adding this in tsconfig.json under compilerOptions

"paths": {
"react": [ "./node_modules/@types/react" ]
}

based from this SO link: https://stackoverflow.com/questions/71841181/some-components-cannot-be-used-as-a-jsx-component

If there's a better way to solve this, let me know. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant