mirror of
https://github.com/airbnb/javascript.git
synced 2026-01-13 22:38:08 -05:00
Merge pull request #1898 from kevinweber/react/props--unnecessary-props
List bad example first to be consistent
This commit is contained in:
@@ -440,17 +440,17 @@ This style guide is mostly based on the standards that are currently prevalent i
|
||||
Filter out unnecessary props when possible. Also, use [prop-types-exact](https://www.npmjs.com/package/prop-types-exact) to help prevent bugs.
|
||||
|
||||
```jsx
|
||||
// good
|
||||
render() {
|
||||
const { irrelevantProp, ...relevantProps } = this.props;
|
||||
return <WrappedComponent {...relevantProps} />
|
||||
}
|
||||
|
||||
// bad
|
||||
render() {
|
||||
const { irrelevantProp, ...relevantProps } = this.props;
|
||||
return <WrappedComponent {...this.props} />
|
||||
}
|
||||
|
||||
// good
|
||||
render() {
|
||||
const { irrelevantProp, ...relevantProps } = this.props;
|
||||
return <WrappedComponent {...relevantProps} />
|
||||
}
|
||||
```
|
||||
|
||||
## Refs
|
||||
|
||||
Reference in New Issue
Block a user