Skip to content

v2.0.0

Latest
Compare
Choose a tag to compare
@cheton cheton released this 14 Dec 12:43
· 1 commit to master since this release
8f5022c

⚠️ Breaking Changes ⚠️

  • Bump the peerDep for react to >= 16.3.0

🎉 Improvements 🎉

  • Support ref forwarding on form controls (#7)
function Example() {
    const inputRef = React.useRef(null);
    const selectRef = React.useRef(null);
    const textareaRef = React.useRef(null);
    const handleChange = (_ref) => (e) => {
        console.log(e.target.value);
        console.log(_ref.current.value);
    };

    return (
        <>
            <Input ref={inputRef} onChange={handleChange(inputRef)} />
            <Select ref={selectRef} onChange={handleChange(selectRef)}>
                <option value="1">One</option>
                <option value="2">Two</option>
            </Select>
            <Textarea ref={textareaRef} onChange={handleChange(textareaRef)} />
        </>
    );
}