mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
More Descriptor -> Element renames
This commit is contained in:
committed by
Paul O’Shannessy
parent
4202fcd9c5
commit
4e203db794
@@ -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.
|
||||
|
||||
### isDescriptorOfType
|
||||
### isElementOfType
|
||||
|
||||
```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
|
||||
|
||||
|
||||
@@ -26,15 +26,15 @@ For more information about the specification object, see [Component Specs and Li
|
||||
|
||||
```javascript
|
||||
ReactComponent render(
|
||||
ReactComponent component,
|
||||
ReactElement element,
|
||||
DOMElement container,
|
||||
[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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
### React.isValidClass
|
||||
|
||||
### React.isValidElement
|
||||
|
||||
```javascript
|
||||
boolean isValidClass(* factory)
|
||||
boolean isValidElement(* object)
|
||||
```
|
||||
|
||||
Verifies the factory is a React class descriptor. See `React.createClass`.
|
||||
|
||||
|
||||
### React.isValidComponent
|
||||
|
||||
```javascript
|
||||
boolean isValidComponent(* object)
|
||||
```
|
||||
|
||||
Verifies the object is a React component descriptor.
|
||||
Verifies the object is a ReactElement.
|
||||
|
||||
|
||||
### 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);
|
||||
```
|
||||
|
||||
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
|
||||
var myComponent = <MyComponent />; // This is just a descriptor.
|
||||
var myComponentElement = <MyComponent />; // This is just a ReactElement.
|
||||
|
||||
// Some code here...
|
||||
|
||||
myComponent = React.render(myComponent, myContainer);
|
||||
var myComponentInstance = React.render(myComponentElement, myContainer);
|
||||
```
|
||||
|
||||
> Note:
|
||||
|
||||
Reference in New Issue
Block a user