1.0.2 • Published 3 years ago

use-input-hook v1.0.2

Weekly downloads
12
License
MIT
Repository
github
Last release
3 years ago

use-input

Stateful hook for controlled input components

NPM JavaScript Style Guide

Install

npm install --save use-input-hook

Usage

import * as React from 'react'

import useInput from 'use-input-hook';

const App = () => {
	const [inputValue, onInputChange] = useInput("");
	const [textAreaValue, onTextAreaChange] = useInput("");
	const [checkBoxValue, onCheckboxChange] = useInput(false, 'checked');
	return (
		<>
			<div>
				Input: <input type='text' value={inputValue} onChange={onInputChange} />
			</div>
			<div>
				Textarea: <textarea value={textAreaValue} onChange={onTextAreaChange} />
			</div>
			<div>
				Checkbox: <input type="checkbox" value={checkBoxValue} onChange={onCheckboxChange} />
			</div>
		</>
	)
}

License

MIT © SiddharthMantri

1.0.2

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago