Skip to content

Commit 45720a7

Browse files
committed
Clarify conditional browser control flow
1 parent 0e581bd commit 45720a7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/content/reference/react-dom/browser.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ export default function SavedDraft() {
236236
237237
### Conditionally rendering on the server {/*conditionally-rendering-in-the-browser*/}
238238
239-
Like other calls to [`use`](/reference/react/use), you can call `use(browser())` conditionally. This lets a Component or custom Hook opt out of server rendering based on a condition, such as the value of a prop passed to it.
239+
Like other calls to [`use`](/reference/react/use), you can call `use(browser())` conditionally. Unlike Hooks, `use` can be called after a conditional return or directly inside a conditional statement. This lets a Component or custom Hook opt out of server rendering based on a condition, such as the value of a prop passed to it.
240240
241-
For example, this `useTimeZone` Hook accepts an optional default value. When provided, React renders the default value in the initial HTML and in the browser. When it is not provided, `use(browser())` suspends the Component during server rendering. In the browser, `use(browser())` does not suspend, so `useTimeZone` returns the device's local time zone.
241+
For example, this `useTimeZone` Hook accepts an optional default value. When provided, React renders the default value in the initial HTML and in the browser. When it is not provided, `use(browser())` suspends the Component during server rendering, but `useTimeZone` returns the device's local time zone when rendering in the browser.
242242
243243
Click **Reload** to see the loading fallback before the user's time zone appears.
244244
@@ -380,7 +380,7 @@ iframe {
380380
381381
</Sandpack>
382382
383-
You can apply the same pattern to a Suspense-enabled data-fetching library. For example, a wrapper can call `use(browser())` before the library's `useQuery` when initial data is missing:
383+
A wrapper around a Suspense-enabled data-fetching library can call `use(browser())` directly inside a condition before the library's `useQuery` when initial data is missing:
384384
385385
```js {3}
386386
function useBrowserQuery(query, options) {

0 commit comments

Comments
 (0)