Package Exports
- use-event-callback
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (use-event-callback) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
React hook useEventCallback
Aimed to be easier to use than useCallback
and solve problems raised in this ticket.
useEventCallback
doesn't need any dependencies list.
The returned function should not be used during rendering.
Example
import useEventCallback from 'use-event-callback';
const Input = () => {
const [value, setValue] = useState('');
const onChange = useEventCallback((event) => {
setValue(event.target.value);
});
return <input value={value} onChange={onChange} />;
}