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

useGeolocation shows infinity loading after update to React 18 (only locally)

Open LobodaAndreyEK opened this issue 2 years ago • 2 comments

For some reason after I updated my project to React 18 and react-use to 17.4, while developing process (on localhost), I have always {loading: true} property. With both options (allowed/disabled)

LobodaAndreyEK avatar Aug 26 '22 14:08 LobodaAndreyEK

Not sure why your bug only happens in React 18, but this might help:

In almost all browsers the Geolocation API is only available in secure contexts (i.e., over https). Try running your project through ngrok locally and check the https address.

willkrakow avatar Sep 11 '22 00:09 willkrakow

@LobodaAndreyEK any reproduce demo?

childrentime avatar Sep 19 '22 03:09 childrentime

React strict mode has to be off for this to work.

madhenry avatar Dec 16 '22 20:12 madhenry

React strict mode has to be off for this to work.

Do you know why this is? Spent forever debugging this issue before I found this thread.

chucksellick avatar Jan 04 '23 06:01 chucksellick

https://reactjs.org/docs/strict-mode.html - might give a better understanding

madhenry avatar Jan 04 '23 10:01 madhenry