hook Options output radio and save check onChange to dispatch SET_OPTIONS
This commit is contained in:
parent
4ffeab701a
commit
252529feda
1 changed files with 19 additions and 3 deletions
|
@ -6,11 +6,27 @@ const Options = props => {
|
||||||
const [ load, setLoad ] = useState('');
|
const [ load, setLoad ] = useState('');
|
||||||
|
|
||||||
const handleRadioChange = e => {
|
const handleRadioChange = e => {
|
||||||
// props.setOptions({...props.options, [e.target.name]: e.target.id})
|
const option = e.target.name;
|
||||||
|
const setValue = e.target.id;
|
||||||
|
props.dispatch({
|
||||||
|
type: 'SET_OPTIONS',
|
||||||
|
value: {
|
||||||
|
option,
|
||||||
|
setValue
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleCheckChange = e => {
|
const handleCheckChange = e => {
|
||||||
// props.setOptions({...props.options, [e.target.name]: e.target.checked})
|
const option = e.target.name;
|
||||||
|
const setValue = e.target.checked ? 'true' : 'false';
|
||||||
|
props.dispatch({
|
||||||
|
type: 'SET_OPTIONS',
|
||||||
|
value: {
|
||||||
|
option,
|
||||||
|
setValue
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleFormSubmit = e => {
|
const handleFormSubmit = e => {
|
||||||
|
|
Loading…
Reference in a new issue