react-map-interaction icon indicating copy to clipboard operation
react-map-interaction copied to clipboard

Creating a minimap controlled from Main Map

Open MrTesau opened this issue 4 years ago • 1 comments

Hi I have created a minimap which follows the main maps translation and zoom. However I have noticed that once I start using state to control map movement and zoom after some time the performance of the app drops significantly. Eg much slower panning and zoom responsiveness. I was wondering if you could shed any light on the issue/what I am doing wrong.

Much appreciated!

Project Github: https://github.com/MrTesau/travel-azeroth-client

MrTesau avatar Dec 19 '20 19:12 MrTesau

Pretty late, but here you go: When using it in controlled mode, move your children to a component and use React.memo (or PureComponent). That way your setState will not cause the map contents to re-render.

episode17 avatar Mar 19 '21 18:03 episode17