Skip to content

Commit 7536f4e

Browse files
committed
added guard clause for server rendering useBreakpoint
1 parent 7154aa6 commit 7536f4e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/hooks/useBreakpoint.js

+6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ const resolveBreakpoint = (width) => {
4848
* @returns {Breakpoint}
4949
*/
5050
export const useBreakpoint = () => {
51+
52+
// for server side rendering
53+
if (typeof window === 'undefined') {
54+
return Breakpoint.xxl;
55+
}
56+
5157
const [size, setSize] = useState(() => resolveBreakpoint(window.innerWidth));
5258

5359
const setBreakpoint = () => {

src/pages/apply.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use client';
2-
31
import React from 'react';
42
import Particles from 'react-particles-js';
53
import Container from 'react-bootstrap/Container';

0 commit comments

Comments
 (0)