@jsxtools/ref-on
v1.0.5
Published
Handle DOM events like React synthetic events.
Downloads
9
Readme
ref-on
ref-on lets you handle DOM events like React synthetic events.
It is 854 bytes (449 gzipped).
Installation
npm install @jsxtools/ref-on
Usage
import on from '@jsxtools/ref-on';
function FormField() {
return (
<p ref={on({
focusin (event) {
console.log(event.target); // <input>
},
input (event) {
console.log(event.target.value); // <input>’s value
}
})}>
<label htmlFor="gn">Given Name</label>
<input id="gn" />
</p>
);
}