0

this is my Form, the props comes from a selector.

const FormIntestazione = (props) => {
    const dispatch = useDispatch();
    const intestazione = props.intestazione;

    const handleChange = (event) => {
        dispatch(actionSetContratto(event.target.id, event.target.value));
    }

    return (
        <Box id="intestazione"
            component="form"
            sx={{
                '& .MuiTextField-root': { m: 1, width: '25ch' },
            }}
            noValidate
            autoComplete="off"
        >
            <div>
                <div >
                    <TextField
                        label="Numero Riferimento"
                        value={intestazione.Riferimento}
                        onChange={handleChange}
                        id="Riferimento"
                        size="small"
                    />
                </div>
            </div>
        </Box>
    )
};

this is the action

export const actionSetContratto = (id, value) => ({ type: SET_CONTRATTO, id: id, value: value })

i know there is many guides online but i can't find one fitting to my case. Could someone please help me? I want to debounce the handlechange of the input and i can't. I tryed with lodash and by defining my own debounce func.

thanks.

  • Does this answer your question? [How to debounce a callback in functional component using hooks](https://stackoverflow.com/questions/56283920/how-to-debounce-a-callback-in-functional-component-using-hooks) – vighnesh153 Sep 20 '22 at 11:25
  • This discussion might help you with that problem [enter link description here](https://stackoverflow.com/questions/23123138/how-to-perform-debounce) – wardvisual Sep 20 '22 at 11:25

0 Answers0