react-async-script-loader
react-async-script-loader copied to clipboard
Promisify the method startLoadingScripts
It's cool to use this method alone, as part of chain or with react-loadable, like that
Loadable.Map({
loader: {
Map: () => import('./Map'),
GoogleMapApi: () => startLoadingScripts('https://maps.googleapis.com/maps/api'),
},
render(loaded, props) {
let Map = loaded.Map.default;
let GoogleMapApi = GoogleMapApi;
return <Map {...props}/>;
},
});