We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 77e565a commit feb9a77Copy full SHA for feb9a77
src/GoogleApiComponent.js
@@ -22,13 +22,15 @@ const defaultCreateCache = (options) => {
22
});
23
};
24
25
-export const wrapper = (options) => (WrappedComponent) => {
26
- const createCache = options.createCache || defaultCreateCache;
+export const wrapper = (input) => (WrappedComponent) => {
27
28
class Wrapper extends React.Component {
29
constructor(props, context) {
30
super(props, context);
31
+ const options = typeof input === 'function' ? input(props) : input;
32
+ const createCache = options.createCache || defaultCreateCache;
33
+
34
this.scriptCache = createCache(options);
35
this.scriptCache.google.onLoad(this.onLoad.bind(this))
36
0 commit comments