Hello. A React newbie here.
I have a long script and for the purpose of managing the code I split it to different components.
I have the widget (parent) component that I store the selected map in the jimuMapView.
Then, I have the children components that need to use the props of the jimuMapView so they add layers and graphics to that map, or other actions like zoom and so forth.
So, my question is how in the children components I can access the jimuMapView from the parent to add the layers?
None of the documentation or examples in ESRI address this scenario.
@RobertScheitlin__GISP , @Grant-S-Carroll or anyone else? Thank you.
activeViewChangeHandler = (jmv: JimuMapView) => {
if (jmv) {this.setState({ jimuMapView: jmv }); }
};
<div className="widget-addLayers jimu-widget p-2">
{this.props.hasOwnProperty("useMapWidgetIds") &&
this.props.useMapWidgetIds &&
this.props.useMapWidgetIds[0] && (
<JimuMapViewComponent
useMapWidgetId={this.props.useMapWidgetIds?.[0]}
onActiveViewChange={this.activeViewChangeHandler}
/>
)}