null-guard useIsEncrypted

This commit is contained in:
Michael Telatynski 2019-12-17 14:05:51 +00:00
parent 3ec60b1692
commit c1133ebfc6
2 changed files with 5 additions and 2 deletions

View file

@ -28,6 +28,9 @@ export const useEventEmitter = (emitter, eventName, handler) => {
useEffect(
() => {
// allow disabling this hook by passing a falsy emitter
if (!emitter) return;
// Create event listener that calls handler function stored in ref
const eventListener = event => savedHandler.current(event);