mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
More Descriptor -> Element renames
This commit is contained in:
committed by
Paul O’Shannessy
parent
b7a548c4bf
commit
1cb3f25e78
@@ -43,13 +43,13 @@ 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.
|
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.
|
||||||
|
|
||||||
### isDescriptorOfType
|
### isElementOfType
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
boolean isDescriptorOfType(ReactDescriptor descriptor, function componentClass)
|
boolean isElementOfType(ReactElement element, function componentClass)
|
||||||
```
|
```
|
||||||
|
|
||||||
Returns true if `descriptor` is an instance of a React `componentClass`.
|
Returns true if `element` is a ReactElement whose type is of a React `componentClass`.
|
||||||
|
|
||||||
### isDOMComponent
|
### isDOMComponent
|
||||||
|
|
||||||
|
|||||||
@@ -26,15 +26,15 @@ For more information about the specification object, see [Component Specs and Li
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
ReactComponent render(
|
ReactComponent render(
|
||||||
ReactComponent component,
|
ReactElement element,
|
||||||
DOMElement container,
|
DOMElement container,
|
||||||
[function callback]
|
[function callback]
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
Render a React component into the DOM in the supplied `container` and return a reference to the component.
|
Render a ReactElement into the DOM in the supplied `container` and return a reference to the component.
|
||||||
|
|
||||||
If the React component was previously rendered into `container`, this will perform an update on it and only mutate the DOM as necessary to reflect the latest React component.
|
If the ReactElement was previously rendered into `container`, this will perform an update on it and only mutate the DOM as necessary to reflect the latest React component.
|
||||||
|
|
||||||
If the optional callback is provided, it will be executed after the component is rendered or updated.
|
If the optional callback is provided, it will be executed after the component is rendered or updated.
|
||||||
|
|
||||||
@@ -73,22 +73,14 @@ string renderToStaticMarkup(ReactComponent component)
|
|||||||
|
|
||||||
Similar to `renderToString`, except this doesn't create extra DOM attributes such as `data-react-id`, that React uses internally. This is useful if you want to use React as a simple static page generator, as stripping away the extra attributes can save lots of bytes.
|
Similar to `renderToString`, except this doesn't create extra DOM attributes such as `data-react-id`, that React uses internally. This is useful if you want to use React as a simple static page generator, as stripping away the extra attributes can save lots of bytes.
|
||||||
|
|
||||||
### React.isValidClass
|
|
||||||
|
### React.isValidElement
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
boolean isValidClass(* factory)
|
boolean isValidElement(* object)
|
||||||
```
|
```
|
||||||
|
|
||||||
Verifies the factory is a React class descriptor. See `React.createClass`.
|
Verifies the object is a ReactElement.
|
||||||
|
|
||||||
|
|
||||||
### React.isValidComponent
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
boolean isValidComponent(* object)
|
|
||||||
```
|
|
||||||
|
|
||||||
Verifies the object is a React component descriptor.
|
|
||||||
|
|
||||||
|
|
||||||
### React.DOM
|
### React.DOM
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ If you're using React components in a larger non-React application or transition
|
|||||||
var myComponent = React.render(<MyComponent />, myContainer);
|
var myComponent = React.render(<MyComponent />, myContainer);
|
||||||
```
|
```
|
||||||
|
|
||||||
Keep in mind, however, that the "constructor" of a component doesn't return a component instance! It's just a **descriptor**: a lightweight representation that tells React what the mounted component should look like.
|
Keep in mind, however, that the JSX doesn't return a component instance! It's just a **ReactElement**: a lightweight representation that tells React what the mounted component should look like.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var myComponent = <MyComponent />; // This is just a descriptor.
|
var myComponentElement = <MyComponent />; // This is just a ReactElement.
|
||||||
|
|
||||||
// Some code here...
|
// Some code here...
|
||||||
|
|
||||||
myComponent = React.render(myComponent, myContainer);
|
var myComponentInstance = React.render(myComponentElement, myContainer);
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note:
|
> Note:
|
||||||
|
|||||||
Reference in New Issue
Block a user