Skip to content

Commit a950710

Browse files
committed
assign isomorphic effect properly
should address issue #30. also bumps to 0.7.0-alpha.1 for pushing to NPM
1 parent 1e03d75 commit a950710

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "use-viewport-sizes",
3-
"version": "0.7.0-alpha.0",
3+
"version": "0.7.0-alpha.1",
44
"description": "a tiny React hook which allows you to track visible window viewport size in your components w/ an optional debounce or custom memo function for updates for optimal rendering.",
55
"main": "./build/index.js",
66
"types": "./build/index.d.ts",

src/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import {
33
useMemo,
44
useCallback,
55
useRef,
6-
useLayoutEffect,
7-
useEffect,
6+
useLayoutEffect
87
} from 'react';
98

109
function getVpWidth() {
@@ -24,9 +23,8 @@ function getVpHeight() {
2423

2524
// Avoid useLayoutEffect warning during SSR
2625
// https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect
27-
function useIsomorphicLayoutEffect() {
28-
typeof window !== 'undefined' ? useLayoutEffect : useEffect;
29-
}
26+
export const useIsomorphicLayoutEffect =
27+
typeof window !== 'undefined' ? useLayoutEffect : () => {};
3028

3129
// =============== //
3230
// Shared State //

0 commit comments

Comments
 (0)