Loading homepage
Manage a controlled text input with dirty and touched flags, stable handlers, and reset behavior.
Input: const input = useInputControl("Ada"); // <input value={input.value} onChange={input.onChange} onBlur={input.onBlur} /> Output: Initially value is "Ada" and both flags are false.
Input: input.setValue("Grace"); input.onBlur(); input.reset(); Output: After reset, value is "Ada", isDirty is false, and isTouched is false.
Implement the exported React hook in index.js or index.ts. Tests provide fixtures for the required behavior.