1.7.0 • Published 5 years ago

@schibstedspain/sui-script-loader v1.7.0

Weekly downloads
2
License
MIT
Repository
-
Last release
5 years ago

ScriptLoader

Description

This components ensures that the render prop is not executed until the given script has been loaded. Also you can safely call this component in multiple places with the same src and it will load it only once.

Installation

$ npm install @schibstedspain/sui-script-loader --save

Usage

Basic usage

import ScriptLoader from '@schibstedspain/sui-script-loader'

const src = 'javascript file url'
const stylesheet = 'stylesheet file url'

return (<ScriptLoader src={src} verifier={() => true} isAsync={false} render={() => 'Ready to render!'} stylesheet={stylesheet}/>)

Find full description and more examples in the demo page.