fix hydration error

This commit is contained in:
DefectingCat
2023-06-25 14:59:22 +08:00
parent 548cb4f146
commit b02d3d98e8

View File

@ -1,5 +1,6 @@
'use client';
import useMounted from 'lib/hooks/use-mounted';
import { useTheme } from 'next-themes';
import Image from 'next/image';
import { memo } from 'react';
@ -8,10 +9,13 @@ const PostCommnetLine = () => {
const { systemTheme, theme } = useTheme();
const currentTheme = theme === 'system' ? systemTheme : theme;
const { mounted } = useMounted();
return (
<>
<div className="flex justify-center select-none">
{currentTheme === 'dark' ? (
{mounted ? (
currentTheme === 'dark' ? (
<Image
src="/images/img/comment-line-dark.svg"
width={300}
@ -25,6 +29,14 @@ const PostCommnetLine = () => {
height={150}
alt=""
/>
)
) : (
<Image
src="/images/img/comment-line.svg"
width={300}
height={150}
alt=""
/>
)}
</div>
</>