Skip to content

Commit 05a37a0

Browse files
authored
Fix TagGroup docs example (#6759)
1 parent 291033b commit 05a37a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -707,9 +707,9 @@ import {ListStateContext} from 'react-aria-components';
707707

708708
function SelectionCount() {
709709
/*- begin highlight -*/
710-
let state = React.useContext(ListStateContext)!;
710+
let state = React.useContext(ListStateContext);
711711
/*- end highlight -*/
712-
let selected = state.selectionManager.selectedKeys.size;
712+
let selected = state?.selectionManager.selectedKeys.size ?? 0;
713713
return <small>{selected} tags selected.</small>;
714714
}
715715

0 commit comments

Comments
 (0)