Closed
Description
I am working on a very simple component with default props.
// React component
class Navigation extends React.Component {
getDefaultProps() {
return {
user: {a:1}
}
}
render() {
console.log(this.props);
if (this.props.user) {
// User has been logged in
return (
...
);
}
else {
// User not logged in
return (
...
);
}
}
}
Navigation.propTypes = {
user: React.PropTypes.object
};
return Navigation;
And I simply render it without any props (<Navigation />
). But I got an empty object from console output.
I am using react 0.13.1, chrome 41, OSX 10.10.
Any idea what is going wrong?
Metadata
Metadata
Assignees
Labels
No labels