DEV Community

🌍 Creating React usePosition() hook for getting browser's geolocation

Oleksii Trekhleb on June 30, 2019

TL;DR In this article we’ll create a React usePosition() hook to fetch and follow browser’s location. Under the hood we’ll use getCurrentPosition a...
Collapse
 
revskill10 profile image
Truong Hoang Dung

I prefer the name useGeolocation to usePosition.

Always prefer explicit to implicit.

Collapse
 
dhruvpatel profile image
Dhruv

This is great! Thanks a lot for sharing.