Add links to docs for addons and top level API (#6555)

This makes it easier to figure out where the docs live.

Googling for e.g. `react-addons-update` also works, but this should
make things easier for people that hyperclick directly to the source.
This commit is contained in:
Desmond Brand
2016-05-02 06:14:28 -07:00
committed by Jim
parent 256753b830
commit db175052c0
17 changed files with 76 additions and 7 deletions
+9 -1
View File
@@ -55,6 +55,8 @@ function forEachSingleChild(bookKeeping, child, name) {
/**
* Iterates through children that are typically specified as `props.children`.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
*
* The provided forEachFunc(child, index) will be called for each
* leaf child.
*
@@ -146,7 +148,9 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
/**
* Maps children that are typically specified as `props.children`.
*
* The provided mapFunction(child, index) will be called for each
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
@@ -173,6 +177,8 @@ function forEachSingleChildDummy(traverseContext, child, name) {
* Count the number of children that are typically specified as
* `props.children`.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
*
* @param {?*} children Children tree container.
* @return {number} The number of children.
*/
@@ -184,6 +190,8 @@ function countChildren(children, context) {
/**
* Flatten a children object (typically specified as `props.children`) and
* return an array with appropriately re-keyed children.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
*/
function toArray(children) {
var result = [];
+7 -4
View File
@@ -16,10 +16,13 @@ var invariant = require('invariant');
/**
* Returns the first child in a collection of children and verifies that there
* is only one child in the collection. The current implementation of this
* function assumes that a single child gets passed without a wrapper, but the
* purpose of this helper function is to abstract away the particular structure
* of children.
* is only one child in the collection.
*
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.only
*
* The current implementation of this function assumes that a single child gets
* passed without a wrapper, but the purpose of this helper function is to
* abstract away the particular structure of children.
*
* @param {?object} children Child collection structure.
* @return {ReactElement} The first and only `ReactElement` contained in the
@@ -740,6 +740,7 @@ var ReactClass = {
/**
* Creates a composite component class given a class specification.
* See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
*
* @param {object} spec Class specification (which must define `render`).
* @return {function} Component constructor function.
@@ -113,6 +113,10 @@ var ReactElement = function(type, key, ref, self, source, owner, props) {
return element;
};
/**
* Create and return a new ReactElement of the given type.
* See https://facebook.github.io/react/docs/top-level-api.html#react.createelement
*/
ReactElement.createElement = function(type, config, children) {
var propName;
@@ -230,6 +234,10 @@ ReactElement.createElement = function(type, config, children) {
);
};
/**
* Return a function that produces ReactElements of a given type.
* See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory
*/
ReactElement.createFactory = function(type) {
var factory = ReactElement.createElement.bind(null, type);
// Expose the type on the factory and the prototype so that it can be
@@ -255,6 +263,10 @@ ReactElement.cloneAndReplaceKey = function(oldElement, newKey) {
return newElement;
};
/**
* Clone and return a new ReactElement using element as the starting point.
* See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement
*/
ReactElement.cloneElement = function(element, config, children) {
var propName;
@@ -335,6 +347,8 @@ ReactElement.cloneElement = function(element, config, children) {
};
/**
* Verifies the object is a ReactElement.
* See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement
* @param {?object} object
* @return {boolean} True if `object` is a valid component.
* @final