Lee Seongho
Lee Seongho

Reputation: 35

How fix react lint error

  renderBanks({ fields, meta: { touched, error } }) {
const { isEdit, value } = this.props;

return (<div>
  {
    fields.map((bank, index) => {
      return (
        <div key={ index } className="form-box">
          <FormGroup label="비고 (해당 안 될시 빈칸)" vertical desc="개인에게 돈을 보낸 경우에는 주민등록번호 / 회사로 보낸 경우에는 사업자 등록번호를 적어주세요.">
            <InputField
              name={ isEdit ? 'remarks' : `${bank}.remarks` }
              component="input"
              placeholder="쓸 수 없는 경우에 계좌번호/은행/계좌주 이름을 넣어주세요."
            />
          </FormGroup>
        </div>
      );
    })
  }
  <div>
    { isEdit ||
    <Button block type="button" size="lg" color="pedaling-outline" onClick={ () => fields.push({}) }>폼 추가</Button>
    }
    {touched && error && <span>{error}</span>}
  </div>
</div>
);
  }

fields.map((bank, index) => { <- '{' lint error

Error: Unexpected block statement surrounding arrow body. (arrow-body-style)

How fix react lint error Please fix

Sorry, i am bad at english

Upvotes: 1

Views: 322

Answers (1)

Arun Ghosh
Arun Ghosh

Reputation: 7734

Return is not required if there is only a single expression in side the arrow function body. Can you try:

fields.map((bank, index) => (
    <div key={ index } className="form-box">
      <FormGroup label="비고 (해당 안 될시 빈칸)" vertical desc="개인에게 돈을 보낸 경우에는 주민등록번호 / 회사로 보낸 경우에는 사업자 등록번호를 적어주세요.">
        <InputField
          name={ isEdit ? 'remarks' : `${bank}.remarks` }
          component="input"
          placeholder="쓸 수 없는 경우에 계좌번호/은행/계좌주 이름을 넣어주세요."
        />
      </FormGroup>
    </div>
  )
)

Upvotes: 1

Related Questions