I am working with Reactjs. My code is working fine in localhost but whenever I am trying to upload on 'vercel' then I am getting following error:
Cannot read properties of undefined (reading 'includes')
I search and actually includes
is being used in routes/index.js
file. Here is our code. Where I am wrong?
const Loadable = (Component) => (props) => {
// eslint-disable-next-line react-hooks/rules-of-hooks
const { pathname } = useLocation();
return (
<Suspense
fallback={<LoadingScreen isDashboard={pathname.includes("/dashboard")} />}
>
<Component {...props} />
</Suspense>
);
};