This may be a trivial oversight, nevertheless; Im trying to dynamically add a featureLayer and associated view.on event to a view that is created inside a useEffect hook. If I specify a second argument in the useEffect hook to listen for when to add the new featureLayer the entire map would be redrawn.
The scenario I am working with is:
This show/load part is where I am having trouble. I can dynamically add what I want however when I do the entire map re-renderes because it is encapsulated inside the same useEffect hook as view. I would add them in an external function however the view and map are defined inside the useEffect hook so that doesn't seem to be an option either. Does anyone have any ideas?