Skip to content

Commit 91dbcc8

Browse files
authored
Merge pull request #228 from dimitarnestorov/master
Switching to a more popular representation of optional arguments
2 parents f1ef9ff + 0560d6b commit 91dbcc8

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

content/docs/reference-react-component.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ For more details, see [*Error Handling in React 16*](/blog/2017/07/26/error-hand
291291
### `setState()`
292292

293293
```javascript
294-
setState(updater, [callback])
294+
setState(updater[, callback])
295295
```
296296

297297
`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
323323
You may optionally pass an object as the first argument to `setState()` instead of a function:
324324

325325
```javascript
326-
setState(stateChange, [callback])
326+
setState(stateChange[, callback])
327327
```
328328

329329
This performs a shallow merge of `stateChange` into the new state, e.g., to adjust a shopping cart item quantity:

content/docs/reference-react-dom.md

+2-10
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ React supports all popular browsers, including Internet Explorer 9 and above.
3333
### `render()`
3434

3535
```javascript
36-
ReactDOM.render(
37-
element,
38-
container,
39-
[callback]
40-
)
36+
ReactDOM.render(element, container[, callback])
4137
```
4238

4339
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
6359
### `hydrate()`
6460

6561
```javascript
66-
ReactDOM.hydrate(
67-
element,
68-
container,
69-
[callback]
70-
)
62+
ReactDOM.hydrate(element, container[, callback])
7163
```
7264

7365
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.

0 commit comments

Comments
 (0)