aJanuary / concarte

Interactive venue maps for conventions
MIT License
2 stars 4 forks source link

Refactor map creation and updates to use effects #1

Closed Mithent closed 2 months ago

Mithent commented 2 months ago

In order to align a bit more closely with React patterns and remove the last selected global, extract creation of the map and updating selected rooms to use effects (also moving the styling to memo and the click event to a callback; I didn't do that with the other event handlers since they seem pretty static at the moment).

Rather than the global to track last selected, I'm using a cleanup function from an effect which sets the style for the selected feature.

I'm sure this could be further improved!

Loading and selecting is still working: https://github.com/user-attachments/assets/09886f28-ed9d-4938-9361-96dcf52bd187