From 94dba9b137be23dc0a7146d634b80da332409efa Mon Sep 17 00:00:00 2001 From: pspelman Date: Fri, 25 May 2018 07:36:02 -0700 Subject: [PATCH] Update MapContainer.js This was an extremely helpful demo. I was unable to get the map to show until I added the componentDidMount(), which I have suggested as an edit to this otherwise wonderful demo! --- src/MapContainer.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/MapContainer.js b/src/MapContainer.js index af21b8a..90cb386 100644 --- a/src/MapContainer.js +++ b/src/MapContainer.js @@ -17,6 +17,10 @@ export default class MapContainer extends Component { ] } + componentDidMount() { + this.loadMap(); // call loadMap function to load the google map upon mounting the component + } + componentDidUpdate() { this.loadMap(); // call loadMap function to load the google map } @@ -63,4 +67,4 @@ export default class MapContainer extends Component { ) } -} \ No newline at end of file +}