JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 31
  • Score
    100M100P100Q57861F
  • License MIT

<Global /> component for React

Package Exports

  • react-global

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-global) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-global

A simple React component for exposing global properties on your page. This library is particularly useful for isomorphic apps, where a set of values must be shared between the server and client (e.g. passing initialization variables to third-party libraries).

Installation

npm install react-global

Code Example

App.jsx

var React = require('react'),
  Global = require('react-global');

var Global = React.createClass({
  render: function() {
    return (
      <html>
        <head>
          ...
          <Global values={{
            FOO: this.props.foo,
            BAR: this.props.bar
          }} />
        </head>
        <body>
          ...
        </body>
      </html>
    );
  },
});

Contributors

Captivation Software (@teamcaptivation), inspired by @theadam

By all means, if you see room for improvement, let us know!

License

MIT License