Skip to content

Commit 044aa37

Browse files
author
Michael Ruoss
committed
Add the configuration function to the README.
1 parent feb9a77 commit 044aa37

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ export default GoogleApiWrapper({
3232
})(MapContainer)
3333
```
3434

35+
Alternatively, the `GoogleApiWrapper` Higher-Order component can be configured by passing a function that will be called with whe wrapped component's `props` and should returned the configuration object.
36+
37+
```javascript
38+
export default GoogleApiWrapper(
39+
(props) => ({
40+
apiKey: props.apiKey,
41+
language: props.language,
42+
}
43+
))(MapContainer)
44+
```
45+
3546
## Sample Usage With Lazy-loading Google API:
3647

3748
```javascript
@@ -90,7 +101,7 @@ initalCenter: Takes an object containing latitude and longitude coordinates. Set
90101
onClick={this.onMapClicked}
91102
>
92103
```
93-
center: Takes an object containing latitude and longitude coordinates. Use this if you want to re-render the map after the initial render.
104+
center: Takes an object containing latitude and longitude coordinates. Use this if you want to re-render the map after the initial render.
94105

95106
```javascript
96107
<Map
@@ -104,7 +115,7 @@ center: Takes an object containing latitude and longitude coordinates. Use this
104115
onClick={this.onMapClicked}
105116
>
106117
```
107-
It also takes event handlers described below:
118+
It also takes event handlers described below:
108119

109120
### Events
110121

0 commit comments

Comments
 (0)