Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 954 Bytes

v2.2.0.md

File metadata and controls

25 lines (17 loc) · 954 Bytes

v2.2.0 Upgrade Guide

getComponent, getComponents signature

This is unlikely to affect you, even if you use getComponent and getComponents.

The signature of getComponent and getComponents has been changed from (location: Location, callback: Function) => any to (nextState: RouterState, callback: Function) => any. That means that instead of writing

getComponent(location, cb) {
  cb(fetchComponent(location.query))
}

You would need to instead write

getComponent(nextState, cb) {
  cb(fetchComponent(nextState.location.query))
}

However, you now also have access to the matched params on nextState, and can use those to determine which component to return.

You will still be able to access location properties directly on nextState until the next breaking release (and in fact they will shadow router state properties, if applicable), but this will case a deprecation warning in development mode.