Attempted import error: 'Switch' is not exported from 'react-router'.
当使用react-router-config中的renderRoutes进行路由的集中管理时,出现如上错误,主要原因是react-router版本自动安装的v6,而react-router-config的版本当前为v5,所以需要降低react-router的版本。
[Feature]: Update react-router-config for v6 of react-router · Issue #8443 · remix-run/react-router · GitHubhttps://github.com/remix-run/react-router/issues/8443在github中给出回复是react-router-config只支持到v5版本,之后的版本已不再支持。记录一下。
We are not keeping react-router-config as a separate package because we now have useRoutes built-in. You should only use it with v5.