Toast fails in create-react-app typescript project with Cannot destructure property 'ref' of 'props' as it is null.
See original GitHub issueuseTransition.tsx:69 Uncaught TypeError: Cannot destructure property 'ref' of 'props' as it is null.
at useTransition (useTransition.tsx:69)
at Message (Message.js:45)
at renderWithHooks (react-dom.development.js:14803)
at mountIndeterminateComponent (react-dom.development.js:17482)
at beginWork (react-dom.development.js:18596)
at HTMLUnknownElement.callCallback (react-dom.development.js:188)
at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
at invokeGuardedCallback (react-dom.development.js:292)
at beginWork$1 (react-dom.development.js:23203)
at performUnitOfWork (react-dom.development.js:22154)
at workLoopSync (react-dom.development.js:22130)
at performSyncWorkOnRoot (react-dom.development.js:21756)
at react-dom.development.js:11089
at unstable_runWithPriority (scheduler.development.js:653)
at runWithPriority$1 (react-dom.development.js:11039)
at flushSyncCallbackQueueImpl (react-dom.development.js:11084)
at flushSyncCallbackQueue (react-dom.development.js:11072)
at discreteUpdates$1 (react-dom.development.js:21893)
at discreteUpdates (react-dom.development.js:806)
at dispatchDiscreteEvent (react-dom.development.js:4168)
useTransition @ useTransition.tsx:69
Message @ Message.js:45
renderWithHooks @ react-dom.development.js:14803
mountIndeterminateComponent @ react-dom.development.js:17482
beginWork @ react-dom.development.js:18596
callCallback @ react-dom.development.js:188
invokeGuardedCallbackDev @ react-dom.development.js:237
invokeGuardedCallback @ react-dom.development.js:292
beginWork$1 @ react-dom.development.js:23203
performUnitOfWork @ react-dom.development.js:22154
workLoopSync @ react-dom.development.js:22130
performSyncWorkOnRoot @ react-dom.development.js:21756
(anonymous) @ react-dom.development.js:11089
unstable_runWithPriority @ scheduler.development.js:653
runWithPriority$1 @ react-dom.development.js:11039
flushSyncCallbackQueueImpl @ react-dom.development.js:11084
flushSyncCallbackQueue @ react-dom.development.js:11072
discreteUpdates$1 @ react-dom.development.js:21893
discreteUpdates @ react-dom.development.js:806
dispatchDiscreteEvent @ react-dom.development.js:4168
index.js:1 The above error occurred in the <Message> component:
in Message (created by ToastManager)
in span (created by ToastManager)
in ToastManager
Where it points to in message:
const transition = useTransition(localShow, null, animation);
My code:
const toast = useToast();
return (
<Button
onClick={() =>
toast({
title: "Tournament Starts Now.",
description: "[Tournament Name] begins now.",
status: "success",
duration: 9000,
isClosable: true,
})
}
>
<Text>Tournament Start</Text>
</Button>
);
};
export const Main = (props: any) => {
const { fullscreen } = props;
const flexCenter = {
justify: "center",
align: "center",
};
return (
<Box {...fullscreen} bg="brand.600">
<Flex flexDirection="column" {...fullscreen} {...flexCenter}>
<Text>TEST</Text>
<ToastExample />
</Flex>
</Box>
);
};```
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Cannot destructure property 'recipes' of ...
I am a beginner in reactjs when I tried to run a program it showed the following error. Uncaught ...
Read more >typescript-cheatsheet - GitHub Pages
A set of TypeScript related notes used for quick reference. The cheatsheet contains references to types, classes, decorators, and many other TypeScript ......
Read more >How to create a custom toast component with React
An error message upon a failed API request; Chat information. In this tutorial, I'll demonstrate how to create a custom toast component with ......
Read more >react cannot read properties of null - You.com | The AI Search ...
In this case, using I get the error: TypeError: Cannot read properties of null (reading 'useContext') The code for this Layout component is...
Read more >“react TypeError [ERR_INVALID_ARG_TYPE]: The "path ...
Failed to execute 'contains' on 'Node': parameter 1 is not of type 'Node' ... argument must be of type string. received undefined typescript...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had to go v9 to get onChange/onFrame to work properly. Is there a way to get this working in v9?
I had the same problem. I had
react-spring
9 as a dependency, whilechakra
uses 8. Removing the dependency on 9 fixed it for me.