Skip to content

Commit ac715ca

Browse files
committed
Use warning messages more similar to React
1 parent aa48ca2 commit ac715ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/react-router/modules/Switch.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ class Switch extends React.Component {
3737
componentWillReceiveProps(nextProps) {
3838
warning(
3939
!(nextProps.location && !this.props.location),
40-
'You cannot change from an uncontrolled to controlled Switch. You passed in a `location` prop on a re-render when initially there was none.'
40+
'<Switch> elements should not change from controlled to uncontrolled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'
4141
)
42+
4243
warning(
4344
!(!nextProps.location && this.props.location),
44-
'You cannot change from a controlled to an uncontrolled Switch. You passed in a `location` prop initially but on a re-render there was none.'
45+
'<Switch> elements should not change from controlled to uncontrolled (or vice versa). You provided a "location" prop initially but omitted it on a subsequent render.'
4546
)
4647
}
4748

0 commit comments

Comments
 (0)