Strapi 用户 react-router-dom
v6
¥Strapi users react-router-dom
v6
Strapi 5 使用 react-router-dom
v6。这会影响使用管理面板 API 添加到 settings 或 menu 的链接。
¥Strapi 5 uses react-router-dom
v6. This impacts the links added to settings or to the menu using the Admin Panel API.
此页面是 重大变更数据库 的一部分,提供有关重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的其他说明。
¥This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.
\🔌 此重大更改是否会影响插件? | \是 |
---|
\🤖 此重大更改是否由 codemod 自动处理? | \是 |
---|
重大更改描述
¥Breaking change description
在 Strapi v4 中
¥In Strapi v4
Strapi v4 使用 react-router-dom v5。
¥Strapi v4 uses react-router-dom v5.
添加设置或菜单链接时,
to
属性是绝对路径。¥When adding settings or menu links, the
to
property is an absolute path.
在 Strapi 5 中
¥In Strapi 5
Strapi v5 使用 react-router-dom v6。
¥Strapi v5 uses react-router-dom v6.
添加设置或菜单链接时,
to
属性现在应该是相对路径。¥When adding settings or menu links, the
to
property should now be a relative path.
迁移
¥Migration
本节重新组合了有关引入的重大更改的有用说明和程序。
¥This section regroups useful notes and procedures about the introduced breaking change.
注意
¥Notes
React Router 官方文档解释了 如何从 v5 升级。
¥The official React Router documentation explains how to upgrade from v5.
菜单或设置链接的绝对路径仍受支持,但应产生警告。
¥Absolute paths for menu or settings links are still supported but should yield a warning.
手动程序
¥Manual procedure
此重大更改应由 codemod 处理(参见 5.0.0 codemods 的完整列表)。确保使用管理面板 API 添加到 settings 或 menu 链接的链接使用相对路径。
¥This breaking change should be handled by a codemod (see the full list of 5.0.0 codemods). Ensure that links added to settings or to the menu links using the Admin Panel API use relative paths.