2
私はeslintからこの警告を受けました。私はcreate-react-appを使用しています。reduxを使用しているときにeslintのエラーが発生しました
./src/components/auth.js
Line 24: Unexpected labeled statement no-labels
Line 24: 'authenticated:' is defined but never used no-unused-labels
Line 24: Expected an assignment or function call and instead saw an expression no-unused-expressions
そして私は、私は以下の私のコンポーネントに問題を持っていないと思うが、それは
import React, { Component } from 'react';
import { connect } from 'react-redux';
export default function(ComposedComponent) {
class Authentication extends Component {
componentWillMount() {
if (!this.props.authenticated) {
this.props.history.replace('/login');
}
}
componentWillUpdate(nextProps) {
if (!nextProps.authenticated) {
this.props.history.replace('/login');
}
}
render() {
return <ComposedComponent {...this.props} />
}
}
return connect(state => {authenticated: state.auth.authenticated})(Authentication);
}
私はeslintを使用して固定すべきか見当もつかない、初めてきませんので、迷惑なんです。
HIマデリーンあなたeslintの設定を保存するために、そのメソッドを使用している場合(あなた.eslintrcまたはpackage.jsonをご提示ください。 – Zargold