Skip to content

Commit

Permalink
added guard clause for server rendering useBreakpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonava committed Feb 20, 2024
1 parent 7154aa6 commit 7536f4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/hooks/useBreakpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ const resolveBreakpoint = (width) => {
* @returns {Breakpoint}
*/
export const useBreakpoint = () => {

// for server side rendering
if (typeof window === 'undefined') {
return Breakpoint.xxl;
}

const [size, setSize] = useState(() => resolveBreakpoint(window.innerWidth));

const setBreakpoint = () => {
Expand Down
2 changes: 0 additions & 2 deletions src/pages/apply.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import React from 'react';
import Particles from 'react-particles-js';
import Container from 'react-bootstrap/Container';
Expand Down

0 comments on commit 7536f4e

Please sign in to comment.