1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Change the Location of a React Leaflet Map with Leaflet's flyTo and setView

    reactReact

    In this lesson, we'll use the Leaflet setView and flyTo methods available on a map instance to change the location of a React Leaflet map. Using buttons to demonstrate, we'll walk through adding the setView method using a position and zoom level as well as the flyTo method which allows us to animate changing the location along with a specified duration.