From 0560d6be8b343b63c4412d35204d5b24847a0eac Mon Sep 17 00:00:00 2001 From: Dimitar Nestorov Date: Tue, 31 Oct 2017 17:25:17 +0200 Subject: [PATCH] Switching to a more popular representation of optional arguments --- content/docs/reference-react-component.md | 4 ++-- content/docs/reference-react-dom.md | 12 ++---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/content/docs/reference-react-component.md b/content/docs/reference-react-component.md index 91da2b36..ea4664ac 100644 --- a/content/docs/reference-react-component.md +++ b/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()` ```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. @@ -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: ```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: diff --git a/content/docs/reference-react-dom.md b/content/docs/reference-react-dom.md index 80bf3b27..043064e2 100644 --- a/content/docs/reference-react-dom.md +++ b/content/docs/reference-react-dom.md @@ -33,11 +33,7 @@ React supports all popular browsers, including Internet Explorer 9 and above. ### `render()` ```javascript -ReactDOM.render( - element, - container, - [callback] -) +ReactDOM.render(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)). @@ -63,11 +59,7 @@ If the optional callback is provided, it will be executed after the component is ### `hydrate()` ```javascript -ReactDOM.hydrate( - element, - container, - [callback] -) +ReactDOM.hydrate(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.