arqex / react-datetime

A lightweight but complete datetime picker react component.
2k stars 869 forks source link

'Datetime' cannot be used as a JSX component. Its instance type 'ReactDatetimeClass' is not a valid JSX element. #829

Open shivakumarm125 opened 2 years ago

shivakumarm125 commented 2 years ago

I'm Submitting a ...

[x] Bug report
[ ] Feature request
[x] Support request

Steps to Reproduce

During Yarn build we are getting the below error.

'Datetime' cannot be used as a JSX component. Its instance type 'ReactDatetimeClass' is not a valid JSX element.

We are using react-datetime inside the functional component. We are trying to use

react-datetime version = v3.1.1 yarn version = v1.22.5 node version = v14.15.0

Expected Results

Successful yarn build for react-datetime

Actual Results

'Datetime' cannot be used as a JSX component. Its instance type 'ReactDatetimeClass' is not a valid JSX element.

Minimal Reproduction of the Problem

Other Information (e.g. stacktraces, related issues, suggestions how to fix)

georgeoffley commented 2 years ago

I actually just ran into this yesterday. We were able to fix it using this solution:

https://stackoverflow.com/questions/71791347/npm-package-cannot-be-used-as-a-jsx-component-type-errors/71828113#71828113

GreenAsJade commented 2 years ago

You didn't write what version of React you are using. I have a feeling this is caused by React 18?