Breaking
-import { RedialContext } from 'react-router-redial';
+import { useRedial } from 'react-router-redial';
+import { applyRouterMiddleware } from 'react-router';
<Router
history={ browserHistory }
routes={ routes }
- render={ (props) => (
- <RedialContext
- { ...props }
- locals={ locals }
- blocking={ ['fetch'] }
- defer={ ['defer', 'done' ] }
- parallel={ true }
- initialLoading={ () => <div>Loading…</div> }
- />
+ render={ applyRouterMiddleware(
+ useRedial({
+ locals,
+ beforeTransition: ['fetch'],
+ afterTransition: ['defer', 'done'],
+ parallel: true,
+ initialLoading: () => <div>Loading…</div>,
+ })
)}
/>
- Renamed and updated parts of the client API to make more sense — #7
deferredLoading => afterTransitionLoading
blocking => beforeTransition
defer => afterTransition
Features
- Updated peerDependency to allow the latest version of
[email protected]
— #8
- Added more data to the lifecycle functions — #7
onError(error, metaData)
onAborted(becauseError)
onCompleted(type)
Now possible to do some nifty error handling using this.
See the documentation for complete information about them.