Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports #8686
-
If faced this issue in console.my component is Test.client.jsx
I import this component this way
and use like this,
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi, I faced the same issue and here are my findings. Even if we mark a component client only by appending As a fix try to render Test only on the client by using an useEffect to determine if it's a client. import Test from "../components/Test.client";
import { useState, useEffect } from "react";
function Parent() {
const [isClient, setIsClient] = useState(false);
useEffect(() => {
isClient(true);
}, []);
return <>{isClient && <Test />}</>;
} Alternatively you can use |
Beta Was this translation helpful? Give feedback.
Hi,
I faced the same issue and here are my findings. Even if we mark a component client only by appending
.client.tsx
, remix renders the parent component where we are using this child component both on server side and client side. When it tries to do a server side render and since theTest
component is clientonly the import would resolve into{}
which is an object hence you see the error.As a fix try to render Test only on the client by using an useEffect to determine if it's a client.