Browse Source

Switching to a more popular representation of optional arguments

main
Dimitar Nestorov 7 years ago
parent
commit
0560d6be8b
  1. 4
      content/docs/reference-react-component.md
  2. 12
      content/docs/reference-react-dom.md

4
content/docs/reference-react-component.md

@ -291,7 +291,7 @@ For more details, see [*Error Handling in React 16*](/blog/2017/07/26/error-hand
### `setState()` ### `setState()`
```javascript ```javascript
setState(updater, [callback]) setState(updater[, callback])
``` ```
`setState()` enqueues changes to the component state and tells React that this component and its children need to be re-rendered with the updated state. This is the primary method you use to update the user interface in response to event handlers and server responses. `setState()` enqueues changes to the component state and tells React that this component and its children need to be re-rendered with the updated state. This is the primary method you use to update the user interface in response to event handlers and server responses.
@ -323,7 +323,7 @@ The second parameter to `setState()` is an optional callback function that will
You may optionally pass an object as the first argument to `setState()` instead of a function: You may optionally pass an object as the first argument to `setState()` instead of a function:
```javascript ```javascript
setState(stateChange, [callback]) setState(stateChange[, callback])
``` ```
This performs a shallow merge of `stateChange` into the new state, e.g., to adjust a shopping cart item quantity: This performs a shallow merge of `stateChange` into the new state, e.g., to adjust a shopping cart item quantity:

12
content/docs/reference-react-dom.md

@ -33,11 +33,7 @@ React supports all popular browsers, including Internet Explorer 9 and above.
### `render()` ### `render()`
```javascript ```javascript
ReactDOM.render( ReactDOM.render(element, container[, callback])
element,
container,
[callback]
)
``` ```
Render a React element into the DOM in the supplied `container` and return a [reference](/docs/more-about-refs.html) to the component (or returns `null` for [stateless components](/docs/components-and-props.html#functional-and-class-components)). Render a React element into the DOM in the supplied `container` and return a [reference](/docs/more-about-refs.html) to the component (or returns `null` for [stateless components](/docs/components-and-props.html#functional-and-class-components)).
@ -63,11 +59,7 @@ If the optional callback is provided, it will be executed after the component is
### `hydrate()` ### `hydrate()`
```javascript ```javascript
ReactDOM.hydrate( ReactDOM.hydrate(element, container[, callback])
element,
container,
[callback]
)
``` ```
Same as [`render()`](#render), but is used to hydrate a container whose HTML contents were rendered by [`ReactDOMServer`](/docs/react-dom-server.html). React will attempt to attach event listeners to the existing markup. Same as [`render()`](#render), but is used to hydrate a container whose HTML contents were rendered by [`ReactDOMServer`](/docs/react-dom-server.html). React will attempt to attach event listeners to the existing markup.

Loading…
Cancel
Save