11# react-render-props-script-loader
22
3- [ ![ Build Status ] ( https://travis-ci.org/ jcoreio/react-render-props-script-loader.svg?branch=master )] ( https://travis-ci.org /jcoreio/react-render-props-script-loader )
3+ [ ![ CircleCI ] ( https://circleci.com/gh/ jcoreio/react-render-props-script-loader.svg?style=svg )] ( https://circleci.com/gh /jcoreio/react-render-props-script-loader )
44[ ![ Coverage Status] ( https://codecov.io/gh/jcoreio/react-render-props-script-loader/branch/master/graph/badge.svg )] ( https://codecov.io/gh/jcoreio/react-render-props-script-loader )
5- [ ![ semantic-release] ( https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg )] ( https://github.com/semantic-release/semantic-release )
65[ ![ Commitizen friendly] ( https://img.shields.io/badge/commitizen-friendly-brightgreen.svg )] ( http://commitizen.github.io/cz-cli/ )
6+ [ ![ npm version] ( https://badge.fury.io/js/react-library-skeleton.svg )] ( https://badge.fury.io/js/react-library-skeleton )
77
88an easier to use dynamic script loader with a [ render prop] ( https://reactjs.org/docs/render-props.html )
99
1010This is useful if you want to wait to load the Google Maps API until the user
11- navigates to a view that uses it. When you mount a ` <ScriptLoader> ` component,
11+ navigates to a view that uses it. When you mount a ` <ScriptLoader> ` component,
1212it will create the script tag you've requested.
1313
1414` <ScriptLoader> ` doesn't load a given script URL more than once, even if there
15- is a pre-existing ` <script> ` tag for that URL that it didn't create. If ` src `
15+ is a pre-existing ` <script> ` tag for that URL that it didn't create. If ` src `
1616prop changes, it will load that new URL.
1717
1818## Version notes
1919
20- * supports React 15 or 16
21- * if building for legacy browsers with a bundler like Webpack that supports the
22- ` module ` field of ` package.json ` , you will probably need to add a rule to
23- transpile this package.
20+ - supports React 15 or 16
21+ - if building for legacy browsers with a bundler like Webpack that supports the
22+ ` module ` field of ` package.json ` , you will probably need to add a rule to
23+ transpile this package.
2424
2525## Installation
2626
@@ -43,7 +43,7 @@ export const MapViewContainer = props => (
4343 onLoad= {() => console .log (' loaded google maps!' )}
4444 onError= {error => console .error (' failed to load google maps:' , error .stack )}
4545 >
46- {({loading, error}) => {
46+ {({ loading, error }) => {
4747 if (loading) return < h3> Loading Google Maps API ... < / h3>
4848 if (error) return < h3> Failed to load Google Maps API : {error .message }< / h3>
4949 return < MapView {... props} / >
7171
7272### ` children ` (` ?(state: State) => ?React.Node ` )
7373
74- The render function. It will be called with an object having the following
74+ The render function. It will be called with an object having the following
7575props, and may return your desired content to display:
76-
77- * ` loading ` (` boolean ` ) - ` true ` iff the script is loading
78- * ` loaded ` (` boolean ` ) - ` true ` iff the script successfully loaded
79- * ` error ` (` ?Error ` ) - the ` Error ` that occurred if the script failed to load
0 commit comments