Skip to content

Commit

Permalink
react/no-unused-state rule doesn't recognize _.pick(this.state, ...)
Browse files Browse the repository at this point in the history
Unfortunately, using _.pick to pull attributes out of the component
state isn't recognized as using those attributes by the
react/no-unused-state eslint rule. More info here:

jsx-eslint/eslint-plugin-react#1626

Rather than disable the rule entirely, I'm removing the one instance
where we were picking attributes from state.

Signed-off-by: Kevin Lingerfelt <kl@buoyant.io>
  • Loading branch information
klingerf committed May 30, 2018
1 parent 4a6449e commit 920e095
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web/app/js/components/util/withREST.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ const withREST = (WrappedComponent, componentPromises, resetProps = []) => {
render() {
return (
<WrappedComponent
{..._.pick(this.state, ['data', 'error', 'loading'])}
data={this.state.data}
error={this.state.error}
loading={this.state.loading}
{...this.props} />
);
}
Expand Down

0 comments on commit 920e095

Please sign in to comment.