diff --git a/docs/class-name-manipulation.html b/docs/class-name-manipulation.html index 9bbcf7ac98..694cb65e79 100644 --- a/docs/class-name-manipulation.html +++ b/docs/class-name-manipulation.html @@ -440,7 +440,7 @@

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 pass class names in as arguments that are then concatenated for you:

+

classSet() also lets you pass class names in as arguments that are then concatenated for you:

render: function() {
   var cx = React.addons.classSet;
   var importantModifier = 'message-important';
diff --git a/docs/more-about-refs.html b/docs/more-about-refs.html
index 6cbc26655a..07d117788b 100644
--- a/docs/more-about-refs.html
+++ b/docs/more-about-refs.html
@@ -475,7 +475,7 @@
 

The ref Callback Attribute #

The ref attribute can be a callback function instead of a name. This callback will be executed immediately after the component is mounted. The referenced component will be passed in as a parameter, and the callback function may use the component immediately, or save the reference for future use (or both).

-

It's as simple as assigning a ref attribute to anything returned from render such as:

+

It's as simple as adding a ref attribute to anything returned from render by using an ES6 arrow function:

  render: function() {
     return <TextInput ref={(c) => this._input = c} } />;
   },
diff --git a/docs/multiple-components.html b/docs/multiple-components.html
index 837d13956b..d2c4921e85 100644
--- a/docs/multiple-components.html
+++ b/docs/multiple-components.html
@@ -443,7 +443,7 @@
   document.getElementById('example')
 );
 

Ownership #

-

In the above example, instances of Avatar own instances of ProfilePic and ProfileLink. In React, an owner is the component that sets the props of other components. More formally, if a component X is created in component Y's render() method, it is said that X is owned by Y. As discussed earlier, a component cannot mutate its props — they are always consistent with what its owner sets them to. This key property leads to UIs that are guaranteed to be consistent.

+

In the above example, instances of Avatar own instances of ProfilePic and ProfileLink. In React, an owner is the component that sets the props of other components. More formally, if a component X is created in component Y's render() method, it is said that X is owned by Y. As discussed earlier, a component cannot mutate its props — they are always consistent with what its owner sets them to. This fundamental invariant leads to UIs that are guaranteed to be consistent.

It's important to draw a distinction between the owner-ownee relationship and the parent-child relationship. The owner-ownee relationship is specific to React, while the parent-child relationship is simply the one you know and love from the DOM. In the example above, Avatar owns the div, ProfilePic and ProfileLink instances, and div is the parent (but not owner) of the ProfilePic and ProfileLink instances.

Children #

diff --git a/docs/test-utils.html b/docs/test-utils.html index 69173a276f..93629b73d1 100644 --- a/docs/test-utils.html +++ b/docs/test-utils.html @@ -405,7 +405,10 @@

React.addons.TestUtils makes it easy to test React components in the testing framework of your choice (we use Jest).

-

Simulate #

Simulate.{eventName}(DOMElement element, object eventData)
+

Simulate #

Simulate.{eventName}(
+  DOMElement element,
+  [object eventData]
+)
 

Simulate an event dispatch on a DOM node with optional eventData event data. This is possibly the single most useful utility in ReactTestUtils.

@@ -422,46 +425,82 @@

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

Simulate has a method for every event that React understands.

-

renderIntoDocument #

ReactComponent renderIntoDocument(ReactElement instance)
+

renderIntoDocument #

ReactComponent renderIntoDocument(
+  ReactElement instance
+)
 

Render a component into a detached DOM node in the document. This function requires a DOM.

-

mockComponent #

object mockComponent(function componentClass, string? mockTagName)
+

mockComponent #

object mockComponent(
+  function componentClass,
+  [string mockTagName]
+)
 

Pass a mocked component module to this method to augment it with useful methods that allow it to be used as a dummy React component. Instead of rendering as usual, the component will become a simple <div> (or other tag if mockTagName is provided) containing any provided children.

-

isElement #

boolean isElement(ReactElement element)
+

isElement #

boolean isElement(
+  ReactElement element
+)
 

Returns true if element is any ReactElement.

-

isElementOfType #

boolean isElementOfType(ReactElement element, function componentClass)
+

isElementOfType #

boolean isElementOfType(
+  ReactElement element,
+  function componentClass
+)
 

Returns true if element is a ReactElement whose type is of a React componentClass.

-

isDOMComponent #

boolean isDOMComponent(ReactComponent instance)
+

isDOMComponent #

boolean isDOMComponent(
+  ReactComponent instance
+)
 

Returns true if instance is a DOM component (such as a <div> or <span>).

-

isCompositeComponent #

boolean isCompositeComponent(ReactComponent instance)`
+

isCompositeComponent #

boolean isCompositeComponent(
+  ReactComponent instance
+)
 

Returns true if instance is a composite component (created with React.createClass()).

-

isCompositeComponentWithType #

boolean isCompositeComponentWithType(ReactComponent instance, function componentClass)
+

isCompositeComponentWithType #

boolean isCompositeComponentWithType(
+  ReactComponent instance,
+  function componentClass
+)
 

Returns true if instance is a composite component (created with React.createClass()) whose type is of a React componentClass.

-

findAllInRenderedTree #

array findAllInRenderedTree(ReactComponent tree, function test)
+

findAllInRenderedTree #

array findAllInRenderedTree(
+  ReactComponent tree,
+  function test
+)
 

Traverse all components in tree and accumulate all components where test(component) is true. This is not that useful on its own, but it's used as a primitive for other test utils.

-

scryRenderedDOMComponentsWithClass #

array scryRenderedDOMComponentsWithClass(ReactComponent tree, string className)
+

scryRenderedDOMComponentsWithClass #

array scryRenderedDOMComponentsWithClass(
+  ReactComponent tree, string className
+)
 

Finds all instances of components in the rendered tree that are DOM components with the class name matching className.

-

findRenderedDOMComponentWithClass #

ReactComponent findRenderedDOMComponentWithClass(ReactComponent tree, string className)
+

findRenderedDOMComponentWithClass #

ReactComponent findRenderedDOMComponentWithClass(
+  ReactComponent tree,
+  string className
+)
 

Like scryRenderedDOMComponentsWithClass() but expects there to be one result, and returns that one result, or throws exception if there is any other number of matches besides one.

-

scryRenderedDOMComponentsWithTag #

array scryRenderedDOMComponentsWithTag(ReactComponent tree, string tagName)
+

scryRenderedDOMComponentsWithTag #

array scryRenderedDOMComponentsWithTag(
+  ReactComponent tree,
+  string tagName
+)
 

Finds all instances of components in the rendered tree that are DOM components with the tag name matching tagName.

-

findRenderedDOMComponentWithTag #

ReactComponent findRenderedDOMComponentWithTag(ReactComponent tree, string tagName)
+

findRenderedDOMComponentWithTag #

ReactComponent findRenderedDOMComponentWithTag(
+  ReactComponent tree,
+  string tagName
+)
 

Like scryRenderedDOMComponentsWithTag() but expects there to be one result, and returns that one result, or throws exception if there is any other number of matches besides one.

-

scryRenderedComponentsWithType #

array scryRenderedComponentsWithType(ReactComponent tree, function componentClass)
+

scryRenderedComponentsWithType #

array scryRenderedComponentsWithType(
+  ReactComponent tree,
+  function componentClass
+)
 

Finds all instances of components with type equal to componentClass.

-

findRenderedComponentWithType #

ReactComponent findRenderedComponentWithType(ReactComponent tree, function componentClass)
+

findRenderedComponentWithType #

ReactComponent findRenderedComponentWithType(
+  ReactComponent tree, function componentClass
+)
 

Same as scryRenderedComponentsWithType() but expects there to be one result and returns that one result, or throws exception if there is any other number of matches besides one.

Shallow rendering #

@@ -469,7 +508,9 @@
ReactShallowRenderer createRenderer()
 

Call this in your tests to create a shallow renderer. You can think of this as a "place" to render the component you're testing, where it can respond to events and update itself.

-
shallowRenderer.render(ReactElement element)
+
shallowRenderer.render(
+  ReactElement element
+)
 

Similar to React.render.

ReactComponent shallowRenderer.getRenderOutput()
diff --git a/support.html b/support.html
index 3dd8acbcc7..3c645562a0 100644
--- a/support.html
+++ b/support.html
@@ -66,7 +66,7 @@
     

React is worked on full-time by Facebook's product infrastructure and Instagram's user interface engineering teams. They're often around and available for questions.

Stack Overflow #

-

Many members of the community use Stack Overflow to ask questions. Read through the existing questions tagged with reactjs or ask your own!

+

Many members of the community use Stack Overflow to ask questions. Read through the existing questions tagged with reactjs or ask your own!

Discussion forum #

For longer-form conversations about React, we've set up a discussion forum at discuss.reactjs.org. This forum is a great place for discussion about best practices and application architecture as well as the future of React. If you have an answerable code-level question, please post it to Stack Overflow instead.