我做了一个新鲜的npm install
,突然收到以下错误
warning.js?8a56:44 Warning: Failed context type: Invalid prop/context relay supplied to Relay(FilesPage), expected undefined to be an object conforming to the RelayEnvironment interface.
in Relay(FilesPage) (created by RouterContext)
in div (created by Row)
in Row (created by Column)
in Column (created by App)
in div (created by StyleRoot)
in StyleRoot (created by App)
in Provider (created by App)
in App (created by AppWithStore)
in Provider (created by AppWithStore)
in AppWithStore (created by RouterContext)
in RouterContext (created by Router)
in Router (created by Root)
in Root
这是我的根容器
const Root = () => (
<Provider store={store}>
<Router
history={browserHistory}
routes={routes}
onReadyStateChange={readyState => {
console.log(99, readyState)
if (!readyState.done) store.dispatch(toggleLoading(true))
else store.dispatch(toggleLoading(false))
}}
render={applyRouterMiddleware(useRelay)}
environment={Relay.Store}
/>
</Provider>
)