Intro
This High Order Component simplifies creating React components whose rendering depends on dynamically loaded scripts.
Your wrapped React component will be mount once the external script is loaded.
Installation
To get started, you can simply install it via npm.
npm i --save react-with-external-script
Example usage
Google Maps Hello World
Component { // Initialize Google Maps document center: lat: -34397 lng: 150644 zoom: 8 ; } { return <div id='map' /> }} 'https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap' Map
D3 Hello World
Component { // Initialize d3 chart d3 text"Hello, world!"; } { return <div className='chart' /> }} 'https://cdnjs.cloudflare.com/ajax/libs/d3/4.12.0/d3.min.js' D3Chart
Test
npm test
License
MIT