This is a minimal reproduction of an issue with React 19.2.0 and Next.js latest version.
Issue: reactjs/react.dev#8034 Potential fix: reactjs/react.dev#8037
Uses the following code
import { useState, Activity } from "react";
//...
const [isShowingSidebar, setIsShowingSidebar] = useState(true);
<Activity mode={isShowingSidebar ? "visible" : "hidden"}>
<Sidebar />
</Activity>
to produce the error:
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.