Skip to content

Commit 369e1e7

Browse files
authored
don't use hooks conditionally in docs (#7473)
1 parent 7eae25e commit 369e1e7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/react-aria-components/docs/Calendar.mdx

+2-1
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,8 @@ function CalendarValue() {
840840
let state = React.useContext(CalendarStateContext)!;
841841
/*- end highlight -*/
842842
let date = state.value?.toDate(getLocalTimeZone());
843-
let formatted = date ? useDateFormatter().format(date) : 'None';
843+
let {format} = useDateFormatter();
844+
let formatted = date ? format(date) : 'None';
844845
return <small>Selected date: {formatted}</small>;
845846
}
846847

packages/react-aria-components/docs/advanced.mdx

+2-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@ function CalendarValue() {
245245
let state = React.useContext(CalendarStateContext)!;
246246
/*- end highlight -*/
247247
let date = state.value?.toDate(getLocalTimeZone());
248-
let formatted = date ? useDateFormatter().format(date) : 'None';
248+
let {format} = useDateFormatter();
249+
let formatted = date ? format(date) : 'None';
249250
return `Selected date: ${formatted}`;
250251
}
251252
```

0 commit comments

Comments
 (0)