'mui ToggleButtonGroup onChange event as a prop not working
I can't get the onChange value when i send it as a prop to be reusable
<ToggleButtonGroup
orientation="vertical"
value={view}
exclusive
onChange={handleFilterClick}
sx={{
width: '100%',
'&.MuiToggleButtonGroup-root .Mui-selected': {
backgroundColor: 'rgb(0 253 255 / 19%) !important',
},
}}
>
and inside the page
const handleChange = (event: React.MouseEvent<HTMLElement>, nextView: string) => {
setView(nextView);};
i have 3 issues
the onChange event works without sending args but i can't get the value
i can't send event arg, event is deprecated
when i add the args i get this error : Type '(event: React.MouseEvent, value: string) => void' is not assignable to type 'VoidFunction'
<MntHeaderWidget CardTitle={RtToggle.CardTitle} ToggleValue={RtToggle.ToggleValue} headerIcon={RtToggle.headerIcon} handleFilterClick={(event: React.MouseEvent, value: string) => handleChange(event, value)} data={RtToggle.data} />
how should i pass the function ? example stackblitz from mui (this onchange event is one the same page but i want to send it as a prop) : stackblitz
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
