所以这有效:
import Page from 'components/Page';
...
render() {
return (
<Route render={props => <Page {...props}/>}/>
);
}
但这不会:
import React, { lazy } from 'react';
const Cmp = lazy(() => import('components/Page'));
...
render() {
return (
<Route render={props => <Cmp {...props}/>}/>
);
}
react 16.8.6 react-router 5.0.0
我明白了:
The above error occurred in one of your React components:
in Unknown (at configured.route.js:41)
in Route (at configured.route.js:41)
in ConfiguredRoute (created by Context.Consumer)
...rest of stack trace
谁能看到我在这里做什么愚蠢的事情?