Skip to content

Commit 0bbf93b

Browse files
committedApr 4, 2015
Move onChange before setState
1 parent 5ff2726 commit 0bbf93b

File tree

2 files changed

+5
-309
lines changed

2 files changed

+5
-309
lines changed
 

‎dist/switcheroo.min.js

+1-305
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎modules/components/Switcher.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ export default class Switcher extends Component {
6666
handleRouteChange(e) {
6767
var newRoute = this.getLocation(),
6868
switchElement = this.getSwitch(newRoute);
69-
this.setState({
70-
visibleComponent: switchElement
71-
});
72-
7369
if(typeof this.props.onChange === 'function') {
7470
this.props.onChange(!!switchElement, newRoute);
7571
}
72+
73+
this.setState({
74+
visibleComponent: switchElement
75+
});
7676
}
7777

7878
render() {

0 commit comments

Comments
 (0)
Please sign in to comment.