여러 입력이 하나의 소스에만 영향을주는 사용자 입력을 만들려면 어떻게해야합니까? 시간을 초로 저장해야하는 "시간 : 분 : 초"로 사용자 정의 시간 입력이 있습니다.여러 입력을 동일한 소스로 타겟팅하는 방법은 무엇입니까?
// calling the custom input with the expected source
<TimeInput source="time_A" />
// in the TimeInput component
<span>
<Field component={NumberInput} name="hh" value={this.state.hh} onChange={this.handleChange} />
<Field component={NumberInput} name="mm" value={this.state.mm} onChange={this.handleChange} />
<Field component={NumberInput} name="ss" value={this.state.ss} onChange={this.handleChange} />
</span>
handleChange 방법은 필드의 이름에 따라 입력 된 값을 구문 분석하고 (이 경우 "time_A") 원본 소스를 업데이트해야합니다 : 나는 지금까지 무엇을 가지고
. 그 업데이트는 내가 정말로 어떻게하는지 알 수 없다.
솔루션은 this.props.input.onChange를 사용할 것이라고 생각하지만 내 this.props.input이 정의되지 않았기 때문에 뭔가 잘못하고 있어야합니다.
의견이 있으십니까?
구성 요소의 전체 코드를 게시 할 수 있습니까? – Gildas