diff --git a/docs/10-addons.md b/docs/10-addons.md
index d076bd12..a0a5cc50 100644
--- a/docs/10-addons.md
+++ b/docs/10-addons.md
@@ -6,7 +6,7 @@ prev: tooling-integration.html
next: animation.html
---
-`React.addons` is where we park some useful utilities for building React apps. **These should be considered experimental** but will eventually be rolled into core or a blessed utilities library:
+The React add-ons are a collection of useful utility modules for building React apps. **These should be considered experimental** and tend to change more often than the core.
- [`TransitionGroup` and `CSSTransitionGroup`](animation.html), for dealing with animations and transitions that are usually not simple to implement, such as before a component's removal.
- [`LinkedStateMixin`](two-way-binding-helpers.html), to simplify the coordination between user's form input data and the component's state.
@@ -20,6 +20,4 @@ The add-ons below are in the development (unminified) version of React only:
- [`TestUtils`](test-utils.html), simple helpers for writing test cases (unminified build only).
- [`Perf`](perf.html), for measuring performance and giving you hint where to optimize.
-To get the add-ons, use `react-with-addons.js` (and its minified counterpart) rather than the common `react.js`.
-
-When using the react package from npm, simply `require('react/addons')` instead of `require('react')` to get React with all of the add-ons.
+To get the add-ons, install them individually from npm (e.g., `npm install react-addons-pure-render-mixin`). We don't support using the addons if you're not using npm.
diff --git a/docs/10.1-animation.md b/docs/10.1-animation.md
index bccdcc98..5cc1defe 100644
--- a/docs/10.1-animation.md
+++ b/docs/10.1-animation.md
@@ -17,7 +17,7 @@ React provides a `ReactTransitionGroup` addon component as a low-level API for a
`ReactCSSTransitionGroup` is the interface to `ReactTransitions`. This is a simple element that wraps all of the components you are interested in animating. Here's an example where we fade list items in and out.
```javascript{28-30}
-var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
+var ReactCSSTransitionGroup = require('react-addons-css-transition-group');
var TodoList = React.createClass({
getInitialState: function() {
@@ -173,7 +173,7 @@ In order for it to apply transitions to its children, the `ReactCSSTransitionGro
In the example above, we rendered a list of items into `ReactCSSTransitionGroup`. However, the children of `ReactCSSTransitionGroup` can also be one or zero items. This makes it possible to animate a single element entering or leaving. Similarly, you can animate a new element replacing the current element. For example, we can implement a simple image carousel like this:
```javascript{10-12}
-var ReactCSSTransitionGroup = React.addons.CSSTransitionGroup;
+var ReactCSSTransitionGroup = require('react-addons-css-transition-group');
var ImageCarousel = React.createClass({
propTypes: {
@@ -201,7 +201,7 @@ You can disable animating `enter` or `leave` animations if you want. For example
## Low-level API: `ReactTransitionGroup`
-`ReactTransitionGroup` is the basis for animations. It is accessible as `React.addons.TransitionGroup`. When children are declaratively added or removed from it (as in the example above) special lifecycle hooks are called on them.
+`ReactTransitionGroup` is the basis for animations. It is accessible from `require('react-addons-transition-group')`. When children are declaratively added or removed from it (as in the example above) special lifecycle hooks are called on them.
### `componentWillAppear(callback)`
@@ -237,11 +237,7 @@ By default `ReactTransitionGroup` renders as a `span`. You can change this behav
```
-Every DOM component that React can render is available for use. However, `component` does not need to be a DOM component. It can be any React component you want; even ones you've written yourself!
-
-> Note:
->
-> Prior to v0.12, when using DOM components, the `component` prop needed to be a reference to `React.DOM.*`. Since the component is simply passed to `React.createElement`, it must now be a string. Composite components must pass the factory.
+Every DOM component that React can render is available for use. However, `component` does not need to be a DOM component. It can be any React component you want; even ones you've written yourself! Just write `component={List}` and your component will receive `this.props.children`.
Any additional, user-defined, properties will become properties of the rendered component. For example, here's how you would render a `
` with CSS class:
diff --git a/docs/10.2-form-input-binding-sugar.md b/docs/10.2-form-input-binding-sugar.md
index 1ff4995a..3270b378 100644
--- a/docs/10.2-form-input-binding-sugar.md
+++ b/docs/10.2-form-input-binding-sugar.md
@@ -46,8 +46,10 @@ var NoLink = React.createClass({
This works really well and it's very clear how data is flowing, however, with a lot of form fields it could get a bit verbose. Let's use `ReactLink` to save us some typing:
```javascript{2,7}
+var LinkedStateMixin = require('react-addons-linked-state-mixin');
+
var WithLink = React.createClass({
- mixins: [React.addons.LinkedStateMixin],
+ mixins: [LinkedStateMixin],
getInitialState: function() {
return {message: 'Hello!'};
},
@@ -96,8 +98,10 @@ As you can see, `ReactLink` objects are very simple objects that just have a `va
### ReactLink Without valueLink
```javascript
+var LinkedStateMixin = require('react-addons-linked-state-mixin');
+
var WithoutLink = React.createClass({
- mixins: [React.addons.LinkedStateMixin],
+ mixins: [LinkedStateMixin],
getInitialState: function() {
return {message: 'Hello!'};
},
diff --git a/docs/10.3-class-name-manipulation.md b/docs/10.3-class-name-manipulation.md
index d6f28f5a..4a3567d4 100644
--- a/docs/10.3-class-name-manipulation.md
+++ b/docs/10.3-class-name-manipulation.md
@@ -8,55 +8,4 @@ next: test-utils.html
> NOTE:
>
-> This module now exists independently at [JedWatson/classnames](https://github.com/JedWatson/classnames) and is React-agnostic. The add-on here will thus be removed in the future.
-
-`classSet()` is a neat utility for easily manipulating the DOM `class` string.
-
-Here's a common scenario and its solution without `classSet()`:
-
-```javascript
-// inside some `` React component
-render: function() {
- var classString = 'message';
- if (this.props.isImportant) {
- classString += ' message-important';
- }
- if (this.props.isRead) {
- classString += ' message-read';
- }
- // 'message message-important message-read'
- return Great, I'll be there.
;
-}
-```
-
-This can quickly get tedious, as assigning class name strings can be hard to read and error-prone. `classSet()` solves this problem:
-
-```javascript
-render: function() {
- var cx = React.addons.classSet;
- var classes = cx({
- 'message': true,
- 'message-important': this.props.isImportant,
- 'message-read': this.props.isRead
- });
- // same final string, but much cleaner
- return Great, I'll be there.
;
-}
-```
-
-When using `classSet()`, pass an object with keys of the CSS class names you might or might not need. Truthy values will result in the key being a part of the resulting string.
-
-`classSet()` also lets you pass class names in as arguments that are then concatenated for you:
-
-```javascript
-render: function() {
- var cx = React.addons.classSet;
- var importantModifier = 'message-important';
- var readModifier = 'message-read';
- var classes = cx('message', importantModifier, readModifier);
- // Final string is 'message message-important message-read'
- return Great, I'll be there.
;
-}
-```
-
-No more hacky string concatenations!
+> This module has been deprecated; use [JedWatson/classnames](https://github.com/JedWatson/classnames) instead.
diff --git a/docs/10.4-test-utils.md b/docs/10.4-test-utils.md
index 24eac44a..6edbabb6 100644
--- a/docs/10.4-test-utils.md
+++ b/docs/10.4-test-utils.md
@@ -6,7 +6,11 @@ prev: two-way-binding-helpers.html
next: clone-with-props.html
---
-`React.addons.TestUtils` makes it easy to test React components in the testing framework of your choice (we use [Jest](https://facebook.github.io/jest/)).
+`ReactTestUtils` makes it easy to test React components in the testing framework of your choice (we use [Jest](https://facebook.github.io/jest/)).
+
+```
+var ReactTestUtils = require('react-addons-test-utils');
+```
### Simulate
@@ -23,7 +27,7 @@ Simulate an event dispatch on a DOM node with optional `eventData` event data. *
```javascript
var node = ReactDOM.findDOMNode(this.refs.button);
-React.addons.TestUtils.Simulate.click(node);
+ReactTestUtils.Simulate.click(node);
```
**Changing the value of an input field and then pressing ENTER**
@@ -31,8 +35,8 @@ React.addons.TestUtils.Simulate.click(node);
```javascript
var node = ReactDOM.findDOMNode(this.refs.input);
node.value = 'giraffe'
-React.addons.TestUtils.Simulate.change(node);
-React.addons.TestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13});
+ReactTestUtils.Simulate.change(node);
+ReactTestUtils.Simulate.keyDown(node, {key: "Enter", keyCode: 13, which: 13});
```
*note that you will have to provide any event property that you're using in your component (e.g. keyCode, which, etc...) as React is not creating any of these for you*
diff --git a/docs/10.5-clone-with-props.md b/docs/10.5-clone-with-props.md
index 597b9b78..279d04a9 100644
--- a/docs/10.5-clone-with-props.md
+++ b/docs/10.5-clone-with-props.md
@@ -12,8 +12,10 @@ next: create-fragment.html
In rare situations, you may want to create a copy of a React element with different props from those of the original element. One example is cloning the elements passed into `this.props.children` and rendering them with different props:
```js
+var cloneWithProps = require('react-addons-clone-with-props');
+
var _makeBlue = function(element) {
- return React.addons.cloneWithProps(element, {style: {color: 'blue'}});
+ return cloneWithProps(element, {style: {color: 'blue'}});
};
var Blue = React.createClass({
diff --git a/docs/10.6-create-fragment.md b/docs/10.6-create-fragment.md
index 92c5218c..91879d4e 100644
--- a/docs/10.6-create-fragment.md
+++ b/docs/10.6-create-fragment.md
@@ -33,20 +33,22 @@ var Swapper = React.createClass({
The children will unmount and remount as you change the `swapped` prop because there aren't any keys marked on the two sets of children.
-To solve this problem, you can use `React.addons.createFragment` to give keys to the sets of children.
+To solve this problem, you can use the `createFragment` add-on to give keys to the sets of children.
-#### `ReactFragment React.addons.createFragment(object children)`
+#### `Array createFragment(object children)`
Instead of creating arrays, we write:
```js
+var createFragment = require('react-addons-create-fragment');
+
if (this.props.swapped) {
- children = React.addons.createFragment({
+ children = createFragment({
right: this.props.rightChildren,
left: this.props.leftChildren
});
} else {
- children = React.addons.createFragment({
+ children = createFragment({
left: this.props.leftChildren,
right: this.props.rightChildren
});
diff --git a/docs/10.7-update.md b/docs/10.7-update.md
index 2e25ede1..8940e8b4 100644
--- a/docs/10.7-update.md
+++ b/docs/10.7-update.md
@@ -44,7 +44,9 @@ While this is fairly performant (since it only makes a shallow copy of `log n` o
`update()` provides simple syntactic sugar around this pattern to make writing this code easier. This code becomes:
```js
-var newData = React.addons.update(myData, {
+var update = require('react-addons-update');
+
+var newData = update(myData, {
x: {y: {z: {$set: 7}}},
a: {b: {$push: [9]}}
});
diff --git a/docs/10.9-perf.md b/docs/10.9-perf.md
index 735aac04..f4f65823 100644
--- a/docs/10.9-perf.md
+++ b/docs/10.9-perf.md
@@ -10,14 +10,14 @@ React is usually quite fast out of the box. However, in situations where you nee
In addition to giving you an overview of your app's overall performance, ReactPerf is a profiling tool that tells you exactly where you need to put these hooks.
+## General API
+
+The `Perf` object documented here is exposed as `require('react-addons-perf')` and can be used with React in development mode only. You should not include this bundle when building your app for production.
+
> Note:
>
> The dev build of React is slower than the prod build, due to all the extra logic for providing, for example, React's friendly console warnings (stripped away in the prod build). Therefore, the profiler only serves to indicate the _relatively_ expensive parts of your app.
-## General API
-
-The `Perf` object documented here is exposed as `React.addons.Perf` when using the `react-with-addons.js` build in development mode.
-
### `Perf.start()` and `Perf.stop()`
Start/stop the measurement. The React operations in-between are recorded for analyses below. Operations that took an insignificant amount of time are ignored.
diff --git a/docs/getting-started.md b/docs/getting-started.md
index 10ed3d22..4bd3a8f4 100644
--- a/docs/getting-started.md
+++ b/docs/getting-started.md
@@ -12,9 +12,31 @@ The easiest way to start hacking on React is using the following JSFiddle Hello
* **[React JSFiddle](https://jsfiddle.net/reactjs/69z2wepo/)**
* [React JSFiddle without JSX](https://jsfiddle.net/reactjs/5vjqabv3/)
-## Starter Kit
+## Using React from npm
-Download the starter kit to get started.
+We recommend using React with a CommonJS module system like [browserify](http://browserify.org/) or [webpack](https://webpack.github.io/). Use the [`react`](https://www.npmjs.com/package/react) and [`react-dom`](https://www.npmjs.com/package/react-dom) npm packages.
+
+```js
+// main.js
+var React = require('react');
+var ReactDOM = require('react-dom');
+
+ReactDOM.render(
+ Hello, world!
,
+ document.getElementById('example')
+);
+```
+
+To install React DOM and build your bundle after installing browserify:
+
+```sh
+$ npm install --save react react-dom
+$ browserify -t babelify main.js -o bundle.js
+```
+
+## Quick Start Without npm
+
+If you're not ready to use npm yet, you can download the starter kit which includes prebuilt copies of React and React DOM.