Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for React router v7 #10440

Open
wants to merge 6 commits into
base: mui-6
Choose a base branch
from
Open

Add support for React router v7 #10440

wants to merge 6 commits into from

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Jan 9, 2025

Problem

react-router v7 is out

Solution

Follow #10437 and #10439

  • Add support for React router v7

  • react-admin packages will still use v6 in their devDependencies to ensure we don't use v7 only features inadvertently.

  • The tutorial and e-commerce demo will use v7 so that we have an easy way to test v7

How To Test

Works with v6

  • build the RA packages locally from this branch
  • create a new react-admin app: npm init react-admin react-admin-router
  • add the MUI deps: npm add react-router@6 react-router-dom@6
  • copy the built packages to the react-admin-router/node_modules directory
  • Run the app & check your lock file

Works with v7

  • change the previous app MUI dependencies to ^7.0.0
  • npm install
  • Run the app & check your lock file

Additional Checks

  • The PR targets master for a bugfix, or next for a feature

@djhi djhi added RFR Ready For Review and removed WIP Work In Progress labels Jan 9, 2025
@@ -1,6 +1,6 @@
import * as React from 'react';
import Button from '@mui/material/Button';
import { Link } from 'react-router-dom';
import { Link } from 'react-router';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This used to be only available from react-router-dom so it "proves" we use v7

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a non breaking change way to migrate to react-router v7 is always use react-router-dom package inside react-admin. It is a re-export of react-router https://reactrouter.com/start/changelog#package-restructuring

Then people using react-router v6 won't be affected by such things like import { Link } from 'react-router(v6)'; that does not exist

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see it is for demo project, not package itself. I misunderstood the previous message.

@slax57 slax57 self-requested a review January 10, 2025 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants