Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/hooks/use-input-state

lib/hooks/use-input-state

Hook combining useState with an onChange handler for form inputs.

Eliminates the repetitive useState + useCallback pattern in form components.

Functions

useInputState()

useInputState(initialValue?): readonly [string, (e) => void, Dispatch<SetStateAction<string>>]

Returns a [value, onChange, setValue] tuple for a text input field.

Parameters

initialValue?

string = ""

Returns

readonly [string, (e) => void, Dispatch<SetStateAction<string>>]

Example

const [email, onEmailChange] = useInputState(); return <Input value={email} onChange={onEmailChange} />;
Last updated on