1
は
このpageからReduxの-フォームについて学ぶが、入力された小道具は、以下のようなフィールドコンポーネントに与えられているかを理解していない:からinput
小道具を取得MyCustonInputさReduxフォームのフィールドコンポーネントはどこから入力プロップを取得しますか?
class MyCustomInput extends Component {
render() {
const { input: { value, onChange } } = this.props
return (
<div>
<span>The current value is {value}.</span>
<button type="button" onClick={() => onChange(value + 1)}>Inc</button>
<button type="button" onClick={() => onChange(value - 1)}>Dec</button>
</div>
)
}
}
?例は、この下に示す:
import MyCustomInput from './MyCustomInput'
...
<Field name="myField" component={MyCustomInput}/>