You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP

react-use-event-hook

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-use-event-hook - npm Package Compare versions

Comparing version

to
0.9.6

@@ -12,5 +12,5 @@ "use strict";

*/
const useBrowserEffect = typeof window !== "undefined"
? // useInsertionEffect only available in React 18+
react_1.default.useInsertionEffect ?? react_1.default.useLayoutEffect
const useInsertionEffect = typeof window !== "undefined"
? // useInsertionEffect is available in React 18+
react_1.default.useInsertionEffect || react_1.default.useLayoutEffect
: () => { };

@@ -26,3 +26,3 @@ /**

const latestRef = react_1.default.useRef(useEvent_shouldNotBeInvokedBeforeMount);
useBrowserEffect(() => {
useInsertionEffect(() => {
latestRef.current = callback;

@@ -29,0 +29,0 @@ }, [callback]);

@@ -6,5 +6,5 @@ import React from "react";

*/
const useBrowserEffect = typeof window !== "undefined"
? // useInsertionEffect only available in React 18+
React.useInsertionEffect ?? React.useLayoutEffect
const useInsertionEffect = typeof window !== "undefined"
? // useInsertionEffect is available in React 18+
React.useInsertionEffect || React.useLayoutEffect
: () => { };

@@ -20,3 +20,3 @@ /**

const latestRef = React.useRef(useEvent_shouldNotBeInvokedBeforeMount);
useBrowserEffect(() => {
useInsertionEffect(() => {
latestRef.current = callback;

@@ -23,0 +23,0 @@ }, [callback]);

{
"name": "react-use-event-hook",
"version": "0.9.5",
"version": "0.9.6",
"description": "Same as React's `useCallback`, but returns a stable reference.",

@@ -5,0 +5,0 @@ "main": "dist/cjs/useEvent.js",

@@ -9,6 +9,6 @@ import React from "react";

*/
const useBrowserEffect =
const useInsertionEffect =
typeof window !== "undefined"
? // useInsertionEffect only available in React 18+
React.useInsertionEffect ?? React.useLayoutEffect
? // useInsertionEffect is available in React 18+
React.useInsertionEffect || React.useLayoutEffect
: () => {};

@@ -25,3 +25,3 @@

const latestRef = React.useRef<TCallback>(useEvent_shouldNotBeInvokedBeforeMount as any);
useBrowserEffect(() => {
useInsertionEffect(() => {
latestRef.current = callback;

@@ -28,0 +28,0 @@ }, [callback]);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet