CodingNic

Add Location & User Interactions

Handle Location Errors

Add Location & User Interactions 10 min read

Handle Location Errors

Task

Show useful feedback when location permission or browser support fails.

File / section

src/App.jsx

Change

Use the unsupported-browser message Geolocation is not supported by this browser.. For the error callback, use Location permission was denied or unavailable.. Keep the existing setError path.

Why this change matters

The user needs an actionable message rather than a silent failure.

Test it

Deny the location permission and verify the error appears below the search controls.

Checkpoint

Location failures are visible and do not crash the app.