Hacker0x01 / react-datepicker

A simple and reusable datepicker component for React
https://reactdatepicker.com/
MIT License
8.11k stars 2.24k forks source link

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

Open dragochar opened 2 years ago

dragochar commented 2 years ago

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):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

bchill42 commented 2 years ago

I'm getting the same error

bugkarma commented 2 years ago

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

Ali-Aref commented 2 years ago

Same error here! any solutions ?

allysonsouza commented 2 years ago

Same problem here, using React 17.0.1

sk-enya commented 1 year ago

Is there any update this issue?

github-actions[bot] commented 5 months ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 10 days.