react-datepicker icon indicating copy to clipboard operation
react-datepicker copied to clipboard

Error when rendering <DatePicker />, invalid hook call.

Open dragochar opened this issue 2 years ago • 6 comments

Describe the bug When using the DatePicker, an error is returned saying:

Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem. React

To Reproduce Steps to reproduce the behavior:

  1. Create a new react app, and import react-datepicker
  2. Create a form

Expected behavior On load, the screen will be white and the console log will show the error.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

dragochar avatar Mar 12 '22 22:03 dragochar

I'm getting the same error

bchill42 avatar Mar 13 '22 06:03 bchill42

Also getting this error. Running on Next.js / Typescript.

bugkarma avatar Mar 25 '22 20:03 bugkarma

Same error here! any solutions ?

Ali-Aref avatar May 18 '22 03:05 Ali-Aref

Same problem here, using React 17.0.1

allysonsouza avatar Jun 23 '22 18:06 allysonsouza

Is there any update this issue?

sk-enya avatar Jul 29 '23 13:07 sk-enya