Skip to main content

useInputValue()

The useInputValue() hook lets you easily manage states for inputs in your components

Import

import { useInputValue } from 'react-haiku';

Usage

Value - None

import { useInputValue } from 'react-haiku';

export const Component = () => {
const [nameValue, setNameValue] = useInputValue('');

return (
<>
<input
placeholder="Type something.."
type="text" value={nameValue}
onChange={setNameValue}
/>
<p>{`Value - ${nameValue ? nameValue : 'None'}`}</p>
</>
);
}