mironov / react-redux-loading-bar

Loading Bar (aka Progress Bar) for Redux and React
https://mironov.github.io/react-redux-loading-bar/
MIT License
936 stars 93 forks source link

Error: Element type is invalid #135

Open alfi-dim opened 6 months ago

alfi-dim commented 6 months ago

Got this error when adding LoadingBar Component on my RemixJS root.tsx

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object

import { Provider } from 'react-redux';
import LoadingBar from 'react-redux-loading-bar';
import stylesheet from '~/tailwind.css';
import NavbarFlowbite from '~/components/Navbar';
import store from '~/states';

export default function App() {
  return (
    <html lang="en">
      <head>
        <meta charSet="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
      </head>
      <body>
        <LoadingBar />
        <Provider store={store}>
          <section>
            <NavbarFlowbite />
            <Outlet />
          </section>
          <ScrollRestoration />
          <Scripts />
          <LiveReload />
        </Provider>
      </body>
    </html>
  );
}
mironov commented 6 months ago

@alfi-dim Hi, thank you for bringing this to my attention. While I'm not entirely certain, I did notice that <LoadingBar> may require access to your redux store. I suggest moving its mounting under <Provider>.