sshyam-gupta / react-router-prompt

A replacement component for the react-router 6 `Prompt`. Allows for more flexible dialogs.

Home Page:https://codesandbox.io/s/react-router-prompt-example-react-router-6-7-y9ug7z?file=/src/App.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Cannot read properties of null (reading 'useEffect')" when used with React 17

karol-majewski opened this issue · comments

Hello and thank you for your work. I gave the latest version a try, and it seems like there's a bug somewhere.

This happens to me when I use the following version of dependencies:

  • react 17.0.2
  • react-dom 17.0.2
  • react-router-dom
  • 6.8.1
  • react-router-prompt 0.5.1

Reproduction:

https://codesandbox.io/s/react-router-prompt-example-react-router-6-7-forked-p3n31e

I noticed that react and react-dom are listed both as peer dependencies and regular dependencies — perhaps that could be the cause of a mismatch?

Hey, @karol-majewski welcome to this repository 🎊. Thank you so much for taking the time to point this out.🙌

@karol-majewski you were right, including them in dependencies was the culprit. Fixed it now in latest version v0.5.2.
Please take a look.
Thank you for making this package better.

https://codesandbox.io/s/react-router-prompt-example-react-router-6-7-forked-7eou0z?file=/src/index.js