Skip to content

Commit 60efc15

Browse files
committed
don’t throw on server in useController #125
1 parent df1b1cc commit 60efc15

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/components/useController.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import ParallaxContext from '../helpers/ParallaxContext';
33

44
export default () => {
55
const parallaxController = useContext(ParallaxContext);
6+
const isServer = typeof window === 'undefined';
7+
if (isServer) {
8+
return null;
9+
}
610

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

0 commit comments

Comments
 (0)