Call external function javascript from React component

If you use external libraries without being able to inject them into your React bundle and you want to work with them directly in one of your React components, you must use window. Once your library or function is supported by the browser, you can access it via this magic word. This allows you to work with libraries not supported by a dependency manager or to optimize your pages with a delayed loading of marketing libraries for example.

class Welcome extends React.Component {
  componentWillMount() {
    window.test(); // Call any external javascript function

  render() {
    return <h1>Hello !</h1>;