Skip to content

Instantly share code, notes, and snippets.

@carmichaelize
Created November 3, 2017 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carmichaelize/6040b0fa0809a82d50d4e3a125bcbfe3 to your computer and use it in GitHub Desktop.
Save carmichaelize/6040b0fa0809a82d50d4e3a125bcbfe3 to your computer and use it in GitHub Desktop.
React — Importing Global Variables from the Window Object
import React, { Component } from 'react';
import Foo from './foo-service';
class FooComponent extends Component {
foo = Foo;
render() {
return (<div>{this.foo.name}</div>)
}
}
export default FooComponent;
declare var Foo;
export default window.Foo;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment