1.1.2 • Published 8 years ago
react-script-tag v1.1.2
react-script-tag
Features:
- A React
<script>tag that supports universal rendering - Client rendering correctly appends the script tag to the page
- Supports client
hydrate() - Works with react dev-tools
- Supports
onLoadandonErrorcallbacks
If you've found this page, you may want to consider using react-html-metadata. It should simplify your use of metadata in React web applications.
Install
NPM
npm install --save react-script-tagYarn
yarn add react-script-tagExample
import React, { Component } from 'react';
import ScriptTag from 'react-script-tag';
class Demo extends Component {
render() {
return (<ScriptTag isHydrating={true} type="text/javascript" src="some_script.js" />);
}
}API
All standard <script> attributes should be supported, including onLoad and onError callbacks.
isHydrating: boolean
Must be true if the client is hydrate()ing the server render, otherwise false. Defaults to false.
Contribute
For questions or issues, please open an issue, and you're welcome to submit a PR for bug fixes and feature requests.
Before submitting a PR, ensure you run npm test to verify that your coe adheres to the configured lint rules and passes all tests. Be sure to include unit tests for any code changes or additions.
License
MIT