Script
npm install react-load-script
Allow you to easily load 3rd party scripts into app when needed
API
The package exports a single component with the following props:
onCreate
onCreate
Called as soon as the script tag is created.
onError
(required)
onError
(required)Called in case of an error with the script.
onLoad
(required)
onLoad
(required)Called when the requested script is fully loaded.
url
(required)
url
(required)URL pointing to the script you want to load.
attributes
attributes
An object used to define custom attributes to be set on the script element. For example, attributes={{ id: 'someId', 'data-custom: 'value' }}
will result in <script id="someId" data-custom="value" />
Example
Last updated