Component don't render inside client component
Unanswered
shadow posted this in #help-forum
shadowOP
Hi devs, I have an component that is getting the data that is being fetched from where the component is being called(page.tsx) and being passed as props to the component itself, and I'm trying to render an countdown from the library
react-countdown (https://www.npmjs.com/package/react-countdown), the countdown requires the use client and now that im using use client, I can't use async and awaits, but for some reason when i try to render the countdown inside that component I get the error that async and awaits are not supported in client components, but I don't have await and async in the component's code2 Replies
shadowOP
the thing is, the component doesnt have any async/awaits, i only have awaits on
in fact i have
so i need to put
i dont think the awaits inside the page.tsx from where the component is being called doesn have something to do with this error, but if it does, i appreciate someone can let me know
page.tsx from where the component is being called but im getting this error everytimeError: async/await is not yet supported in Client Components, only Server Components. This error is often caused by accidentally adding `'use client'` to a module that was originally written for the server.in fact i have
'use client' in the components, if i remove it i get Error: Super expression must either be null or a functionso i need to put
'use client' anywaysi dont think the awaits inside the page.tsx from where the component is being called doesn have something to do with this error, but if it does, i appreciate someone can let me know
ReactJS has escape hatch named useEffect where you can implement asynchronous functions and then call them, and await. ideally it should be hidden in custom hooks.