react-for-atom v15.3.1-0
react-for-atom
Singleton lazy loading wrapper around facebook/react.
A single instance of React
React does not currently co-exist well with other instances of React in the same environment (see #3252, #2402).
We propose that Atom package developers wanting to use React require this package instead of other variants of React. react-for-atom
exports
React
, ReactDOM
, and all of React's addons.
Using CommonJS
const {
createFragment,
CSSTransitionGroup,
LinkedStateMixin,
Perf,
PureRenderMixin,
React,
ReactDOM,
ReactDOMServer,
shallowCompare,
TestUtils,
TransitionGroup,
update,
} = require('react-for-atom');
// optional
const {PropTypes} = React;
Using (babel transpiled) ES Modules
// React is the default export
import React, {
ReactDOM,
TestUtils,
// addons...
} from 'react-for-atom';
// Or, it's also available as a named export
import {
React,
ReactDOM,
TestUtils,
// addons...
} from 'react-for-atom';
We plan to closely track the React release cycle in order to be able to use the latest features as well as provide access to React API warnings (in atom --dev
mode).
Lazy loading
Only when a property is looked up on the react-for-atom
export is that module actually require
'd.
const ReactForAtom = require('react-for-atom');
// `react` is actually required here
const {React} = ReactForAtom;
// `TestUtils` is actually required here
const {TestUtils} = ReactForAtom;
Versioning
Prior to 0.14.6
, react-for-atom
version numbers were loosely related to the React version in dependencies
. From that version onward, the version of react-for-atom
matches the React version.
Changes to react-for-atom
are reflected in pre-release versions (e.g. 0.14.6-1
). From a semver perspective, this doesn't make sense. However, because you should pin the version of react-for-atom
anyway, this is a clear workaround for conveying React versioning info.