We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d58e445 commit b946414Copy full SHA for b946414
1 file changed
packages/xstate-react/src/useSelector.ts
@@ -38,8 +38,8 @@ export function useSelector<
38
39
const boundGetSnapshot = useCallback(() => actor?.getSnapshot(), [actor]);
40
const boundSelector: typeof selector = useCallback(
41
- (snapshot: Snapshot<any>) => {
42
- if (snapshot.status === 'error') {
+ (snapshot: Snapshot<any> | undefined) => {
+ if (snapshot?.status === 'error') {
43
throw snapshot.error;
44
}
45
return selector(snapshot as never);
0 commit comments