So say you have a custom hook:
useCustomHook()=>{ const [state, setState] = React.useState(0); const modifyState = ({state, n}) => {setState(state +