tomwayson / esri-loader-hooks

Custom React hooks for using the ArcGIS API for JavaScript with esri-loader.

Home Page:https://esri-loader-hooks.netlify.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Updating a map via view hooks

stevenlivz opened this issue · comments

Hi - this is more of a question than an issue but it is fairly urgent, so here goes. I am very new to React, so ...

On "Working with view hooks" you have a sample near the end and say "zoom prop has changed, update view" ... do you have any code that shows how to update the zoom prop from a parent, e.g. the App function via a button onClick? You initialise it in the constructor to {zoom=4} I can update the zoom property from within the function but i want to have a button outside that updates the zoom. I can change it via setState but that causes a re-render which is not what i want. I need to do a similar thing adding layers and i don't want them re-rendering every time i dynamically add a new layer. Any ideas?

thanks.