-
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.
refactor code remove popover warn chakra-ui/chakra-ui#1988
- Loading branch information
1 parent
da6eeda
commit 4b6f5a6
Showing
12 changed files
with
135 additions
and
439 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
This file was deleted.
Oops, something went wrong.
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
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
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
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
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,15 @@ | ||
import useHasMounted from "./useHasMounted" | ||
|
||
const OnlyOnClient: React.FC<React.PropsWithChildren> = ({ children }) => { | ||
const isMounted = useHasMounted() | ||
|
||
if (!isMounted) return null | ||
|
||
return ( | ||
<> | ||
{children} | ||
</> | ||
) | ||
} | ||
|
||
export default OnlyOnClient |
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,11 @@ | ||
import { useState, useEffect } from "react"; | ||
|
||
const useHasMounted = () => { | ||
const [isMounted, setIsMounted] = useState(false); | ||
useEffect(() => { | ||
setIsMounted(true); | ||
}, [isMounted]); | ||
return isMounted; | ||
}; | ||
|
||
export default useHasMounted; |
Oops, something went wrong.