Skip to content

Commit 71f8764

Browse files
committed
check for server in useController
1 parent 6200176 commit 71f8764

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/hooks/useController.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@ import { useContext } from 'react';
22
import { ParallaxController } from 'parallax-controller';
33
import { ParallaxContext } from '../context/ParallaxContext';
44

5-
export function useController(): ParallaxController {
5+
export function useController(): ParallaxController | {} {
66
const parallaxController = useContext(ParallaxContext);
7+
const isServer = typeof window === 'undefined';
8+
if (isServer) {
9+
return {};
10+
}
711

812
if (!parallaxController) {
913
throw new Error(

0 commit comments

Comments
 (0)