Skip to content

Commit 41766b5

Browse files
committed
Style tweaks
1 parent ff3a8cd commit 41766b5

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

modules/utils/createRouter.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ function createRouter(options) {
167167
}
168168
}
169169

170-
function updateState() {
171-
state = nextState;
172-
}
173-
174170
if (typeof location === 'string') {
175171
warning(
176172
!canUseDOM || process.env.NODE_ENV === 'test',
@@ -399,13 +395,14 @@ function createRouter(options) {
399395
if (error || transition.isAborted)
400396
return dispatchHandler.call(router, error, transition);
401397

402-
nextState = {};
403-
nextState.path = path;
404-
nextState.action = action;
405-
nextState.pathname = pathname;
406-
nextState.routes = nextRoutes;
407-
nextState.params = nextParams;
408-
nextState.query = nextQuery;
398+
nextState = {
399+
path: path,
400+
action: action,
401+
pathname: pathname,
402+
routes: nextRoutes,
403+
params: nextParams,
404+
query: nextQuery
405+
};
409406

410407
dispatchHandler.call(router, null, transition);
411408
});
@@ -498,13 +495,11 @@ function createRouter(options) {
498495
},
499496

500497
getInitialState: function () {
501-
updateState();
502-
return state;
498+
return (state = nextState);
503499
},
504500

505501
componentWillReceiveProps: function () {
506-
updateState();
507-
this.setState(state);
502+
this.setState(state = nextState);
508503
},
509504

510505
componentWillUnmount: function () {

0 commit comments

Comments
 (0)