Skip to content

Instantly share code, notes, and snippets.

@matiasfha
Created May 13, 2018 21:07
Show Gist options
  • Save matiasfha/d4e15141b6664fe63d5775ee0a18577b to your computer and use it in GitHub Desktop.
Save matiasfha/d4e15141b6664fe63d5775ee0a18577b to your computer and use it in GitHub Desktop.
Check props on componentWillMount
class Component extends React.Component {
componentWillMount() {
warning(
!(this.props.component && this.props.render),
"You should not use <Route component> and <Route render> in the same route; <Route render> will be ignored"
);
warning(
!(
this.props.component &&
this.props.children &&
!isEmptyChildren(this.props.children)
),
"You should not use <Route component> and <Route children> in the same route; <Route children> will be ignored"
);
warning(
!(
this.props.render &&
this.props.children &&
!isEmptyChildren(this.props.children)
),
"You should not use <Route render> and <Route children> in the same route; <Route children> will be ignored"
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment