-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(routes/index): only render map client-side
This patch fixes a server-client error that was occurring because `react-simple-maps` does not fully support server-side rendering. I should fix this upstream, but this is a temporary fix to avoid surfacing the error message in my application. Ref: zcreativelabs/react-simple-maps#337
- Loading branch information
1 parent
9765598
commit 5689b73
Showing
2 changed files
with
57 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { type PropsWithChildren, useState, useEffect } from 'react' | ||
|
||
export function ClientOnly({ children }: PropsWithChildren) { | ||
const [mounted, setMounted] = useState(false) | ||
useEffect(() => setMounted(true), []) | ||
/* eslint-disable-next-line react/jsx-no-useless-fragment */ | ||
return mounted ? <>{children}</> : null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5689b73
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
dolce – ./
www.dolce.so
dolce.so
rottenfashion.com
dolce-git-main-nicholaschiang.vercel.app
dolce-nicholaschiang.vercel.app
www.rottenfashion.com
nicholas.engineering
www.nicholas.engineering