interface SearchProps {
getGroup: (check?: boolean) => void;
saveFunc: () => void;
}
const [state, setState] = useState({ checked: false })
const handleCheckboxChange = () => {
setState({ ...state, checked: !state.checked })
}
const searchGroup = () => {
props.spinnerOn();
props.getGroup(state.checked);
}
return props.show ? ReactDOM.createPortal((
<FormControlLabel
control={<Checkbox checked={state.checked} onChange={handleCheckboxChange} name="SG" />}
label="SG" labelPlacement="top"
/>
}
const mapStateToProps = (state: ApplicationState) => {
return {
results: state.results
}
}
const mapDispatchToProps = (dispatch: any) => {
return {
getGroup: (check? : boolean) =>
dispatch(actionTypes.getGroup(check))
}
}
export default connect(mapStateToProps, mapDispatchToProps)(SearchGroup);
Currently when I attempt the search, the url returned has checked returning "undefined" instead of true when checked, and false when unchecked
Not sure what I'm missing?
Aucun commentaire:
Enregistrer un commentaire