4

I'm trying to upgrade React Admin to V3 but I'm facing issues.

I'm including RA in my SPA when the user types the route myapp/admin. My app includes a custom route to include the Admin component when the route is hit. More or less like so:

// in src/App.js
import Admin from "./admin/App";
export default ({ childProps }) =>
  <Switch>
      <Route path="/admin" exact component={Admin} />
  </Switch>;

// in admin/App.js
// various imports
const App = () => (
  <Admin
    loginPage={MyLoginPage}
    authProvider={authProvider}
    dataProvider={dataProvider}
  >
  </Admin>
);

This approach was working before upgrading to V3. However now, after upgrading react admin and its dependencies, I hit the following error

Error: Could not find "store" in the context of "Connect(ConnectedRouterWithContext)". Either wrap the root component in a <Provider>, or pass a custom React context provider to <Provider> and the corresponding React context consumer to Connect(ConnectedRouterWithContext) in connect options.

Some more info:

  • I suspect that this is either due to a version mismatch or that I need to wrap Admin in a Provider. The doc provides more instructions on Including React-Admin In Another Redux Application. However my parent app is not using redux nor redux-saga, and I don't have much knowledge on these framework now.
  • I have followed the UPGRADE guide but have not found the answer to my problem there yet.
  • I believe I have the right versions for my dependencies (most of which I've had to install specifically for the upgrade):
    "ra-data-json-server": "^3.0.4",
    "ra-data-simple-rest": "^3.0.3",
    "react": "^16.9.0",
    "react-dom": "^16.9.0",
    "react-redux": "^7.1.3",
    "redux-saga": "^1.1.3",
    "@material-ui/core": "^4.4.0",
    "@material-ui/icons": "^4.2.1",
7hibault
  • 2,371
  • 3
  • 23
  • 33

1 Answers1

2

Stumbled upon the same issue - if question still valid or somebody else is searching for a solution. Upgrading following packages resolved the issue for me:

After upgrading to react-admin@3.3.0

Upgraded also to (currenlty) latest

  • redux@4.0.5
  • react-redux@7.2.0
Kia Kaha
  • 1,565
  • 1
  • 17
  • 39