I am trying to use this script from the ArcGIS JS API to zoom in for a client-side feature layer. However, I get the error on line 7 due to the 'this' keyword. The prop is necessary since I am referring to the view from another module as suggested from another posting. The error is related to the 'this' in a class component. I tried to bind the goTo but didn't work.
@RobertScheitlin__GISP , @Grant-S-Carroll or anyone else? Thank you.
this.props.mapView.goTo(response.extent).bind(this);
Error:

Script:
this.props.mapView.whenLayerView(layer).then(function (layerView) {
layerView.watch("updating", function (val) {
// wait for the layer view to finish updating
if (!val) {
layerView.queryExtent().then(function (response) {
// go to the extent of all the graphics in the layer view
this.props.mapView.goTo(response.extent);
});
}
});
});