This repo was a one-trick-pony for the SEW talk and is now deprecated and no longer maintained. If you're looking for the JSSDK / React / MobX pattern, please visit this repo.
Update the code so the StatusCmp
displays the center point of the map and updates as it changes when moving the map.
- The
StatusCmp
already uses another hook to display data out of its own store.. but it looks kinda sad. It's not updating! What can you do to actually update?
src/Map/MapController
is the class initializing WebMap and MapView. Look for the code block that ensures that MapView is initialized. Use JSSDK methods in it to watch for the right data and bring it into stage mgmt.src/Status/StatusCmp
is the place to display your data. TheuseStores
hook will give you access to the MapStore. Add some output for your center property down in the JSX section.
MapStore
is the state mgmt class for your map. A class variable for the center point as well as a setter function have already been prepared for you. You don't need to change anything here, but use them wisely! Please note that the class variable is marked asobservable
, so the component re-renders when the value changes.MapProvider
anduseMapContext
are the context provider and hook to provide programmatic access to your map to other parts of your application. You don't need to touch these for this task.