Fix useEventEmitter to support passing all callback arguments

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2020-05-24 14:11:25 +01:00
parent 37d04d6ceb
commit 02ddda587b
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ export const useEventEmitter = (emitter, eventName, handler) => {
if (!emitter) return;
// Create event listener that calls handler function stored in ref
const eventListener = event => savedHandler.current(event);
const eventListener = (...args) => savedHandler.current(...args);
// Add event listener
emitter.on(eventName, eventListener);