Skip to content

Commit

Permalink
fix(MobileProvider): fix SSR compatibility (#897)
Browse files Browse the repository at this point in the history
Co-authored-by: 3y3 <[email protected]>
  • Loading branch information
3y3 and 3y3 authored Aug 17, 2023
1 parent c235cf6 commit 9c6f5a7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/mobile/MobileProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ export function MobileProvider({
[useHistory],
);

document.body.classList.toggle(rootMobileClassName, mobileValue);
React.useEffect(() => {
document.body.classList.toggle(rootMobileClassName, mobileValue);
}, [rootMobileClassName, mobileValue]);

const state: MobileContextProps = React.useMemo(() => {
return {
Expand Down

0 comments on commit 9c6f5a7

Please sign in to comment.