Skip to content

Use ReactDOM from window/global scope #526

@harlow

Description

@harlow

Facebook's install page (https://github.com/facebook/react#installation) recommends including both React and ReactDOM from CDN.

<!-- The core React library -->
<script src="https://fb.me/react-0.14.0.js"></script>
<!-- The ReactDOM Library -->
<script src="https://fb.me/react-dom-0.14.0.js"></script>

By using this style we don't need to vendor ReactDOM directly. Would it make sense to do this:

var ReactDOM = (typeof window !== "undefined" ? window['ReactDOM'] : typeof global !== "undefined" ? global['ReactDOM'] : null);

Here:
https://github.com/JedWatson/react-select/blob/master/dist/react-select.js#L73

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions