Closed jpmbvistro closed 9 months ago
having the same issues as well with AccessibleIcon
since it is using VisuallyHidden
.
useEffect only works in Client Components. Add the "use client" directive at the top of the file to use it.
@jpmbvistro @davidkhierl Ideally, you should abstract this out! or create your own visually hidden component with plain css instead of using the radix package.
'use client';
import * as VisuallyHiddenPrimitive from '@radix-ui/react-visually-hidden';
interface Props {
children: React.ReactNode;
}
export default function VisuallyHidden({ children }: Props) {
return (
<VisuallyHiddenPrimitive.Root>{children}</VisuallyHiddenPrimitive.Root>
);
}
@yaralahruthik is correct, the library isn't yet natively supporting RSC (doesn't include use client
where needed yet).
The recommended solution is still to wrap it and add use client
where appropriate.
Bug report
Current Behavior
When using utility component in a NextJs 13 App Dir server component you get the following error thrown:
Expected behavior
Page renders properly w/o error as a server component
Reproducible example
Add the component in a server component
Suggested solution
Current fix is to abstract the implementation into its own client component and import it into the server component.
Additional context
This was tested in subroutes, root dir, parallel slots, all have the same issue.
Your environment