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.
重大变更描述
🌐 Breaking change description
在 Strapi v4 中
- Strapi v4 使用 react-router-dom v5。
- 在添加设置或菜单链接时,
to属性是绝对路径。
在 Strapi 5 中
- Strapi v5 使用 react-router-dom v6。
- 在添加设置或菜单链接时,
to属性现在应该是相对路径。
迁移
🌐 Migration
本节重新组合了有关引入的重大更改的有用说明和程序。
🌐 This section regroups useful notes and procedures about the introduced breaking change.
注意
🌐 Notes
- 官方的 React Router 文档解释了 how to upgrade from v5。
- 菜单或设置链接的绝对路径仍受支持,但应产生警告。
手动操作
🌐 Manual procedure
这个重大更改应该由 codemod 处理(参见 full list of 5.0.0 codemods)。 确保通过管理员面板 API 添加到 设置 或 菜单 链接的链接使用相对路径。