Keep an object in state and update it with partial changes, like the setState of a class component.
This is custom React hooks, you need to follow the Basic Rules when you use it.
Changing one field keeps the others.
const useSetState = <T extends Record<string, unknown>>(
initialState: T,
) => [
T,
(partial: Partial<T> | ((current: T) => Partial<T>)) => void,
]