Package Exports
- react-weblibrary
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-weblibrary) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
react-weblibrary
Another react hook for loading scripts from the web
import { useWebLibrary } from 'react-weblibrary'
function MyComponent() {
// expect the script from https://example.com/someLibrary to define window.$
// if the global exists (e.g. because the script is already requested in <head>, the script will not be requested
const [someLibrary, status] = useWebLibrary('$', 'https://example.com/someLibrary')
if (!someLibrary) {
return status === 'try' ? 'Still loading...' : 'Something went wrong.'
}
someLibrary.someFunction()
}