diff --git a/packages/react-aria-components/docs/TagGroup.mdx b/packages/react-aria-components/docs/TagGroup.mdx index 9bab430b076..54ae7775aa8 100644 --- a/packages/react-aria-components/docs/TagGroup.mdx +++ b/packages/react-aria-components/docs/TagGroup.mdx @@ -707,9 +707,9 @@ import {ListStateContext} from 'react-aria-components'; function SelectionCount() { /*- begin highlight -*/ - let state = React.useContext(ListStateContext)!; + let state = React.useContext(ListStateContext); /*- end highlight -*/ - let selected = state.selectionManager.selectedKeys.size; + let selected = state?.selectionManager.selectedKeys.size ?? 0; return {selected} tags selected.; }