Clarify anti-pattern in getDefaultProps
prakhar1989 opened this issue · comments
Don't use props to set your initial state. It's a anti-pattern and it is only acceptable, when you do something like call the prop something like:
initialCount
.
This is a bit unclear (since initailCount
is not mentioned anywhere). I think you can update that section with the below snippet
getInitialState: function() {
return {
count: this.props.initialCount // this is fine
}
}
Updated!