You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/reference/react-dom/browser.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -238,7 +238,7 @@ export default function SavedDraft() {
238
238
239
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.
240
240
241
-
For example, `useTimeZone` accepts an optional initial value. If provided, that value is included in the initial HTML and rendered in the browser. If not, `use(browser())`causes the Component calling `useTimeZone` to suspend during server rendering. In the browser, `useTimeZone`reads 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. In the browser, `use(browser())` does not suspend, so `useTimeZone`returns the device's local time zone.
242
242
243
243
Click **Reload** to see the loading fallback before the user's time zone appears.
244
244
@@ -248,8 +248,8 @@ Click **Reload** to see the loading fallback before the user's time zone appears
248
248
import { Suspense } from'react';
249
249
import { useTimeZone } from'./useTimeZone.js';
250
250
251
-
functionTimeZone({label, initialTimeZone}) {
252
-
consttimeZone=useTimeZone(initialTimeZone);
251
+
functionTimeZone({label, defaultTimeZone}) {
252
+
consttimeZone=useTimeZone(defaultTimeZone);
253
253
return<p>{label}:<strong>{timeZone}</strong></p>;
254
254
}
255
255
@@ -259,7 +259,7 @@ export default function App() {
259
259
<h1>Event details</h1>
260
260
<TimeZone
261
261
label="Event time zone"
262
-
initialTimeZone="America/New_York"
262
+
defaultTimeZone="America/New_York"
263
263
/>
264
264
<Suspense fallback={<p>Loading your time zone...</p>}>
265
265
<TimeZone label="Your time zone"/>
@@ -273,12 +273,12 @@ export default function App() {
273
273
import { use } from'react';
274
274
import { browser } from'react-dom';
275
275
276
-
exportfunctionuseTimeZone(initialTimeZone) {
277
-
if (initialTimeZone!==undefined) {
278
-
returninitialTimeZone;
276
+
exportfunctionuseTimeZone(defaultTimeZone) {
277
+
if (defaultTimeZone!==undefined) {
278
+
returndefaultTimeZone;
279
279
}
280
280
281
-
use(browser('No initial time zone was provided.'));
281
+
use(browser('No default time zone was provided.'));
@@ -400,7 +400,7 @@ function ProductDetails({ productId, initialData }) {
400
400
}
401
401
```
402
402
403
-
This way, if `initialData` is not provided, `useBrowserQuery` skips server rendering, leaving the closest [`<Suspense>`](/reference/react/Suspense) boundary's fallback in the HTML. In the browser, `use(browser())` does not suspend, so the query library can fetch the data or read it from its client cache as usual.
403
+
If `initialData` is not provided, `useBrowserQuery` skips server rendering and leaves the closest [`<Suspense>`](/reference/react/Suspense) boundary's fallback in the HTML. In the browser, `use(browser())` does not suspend, so the query library can fetch the data or read it from its client cache as usual.
0 commit comments