Skip to content

Commit

Permalink
4.6.12
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Jan 19, 2024
1 parent 5bb6dec commit 65cd3e9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"dependencies": {
"@vercel/analytics": "^1.1.1",
"emoji-picker-react": "^4.6.11",
"emoji-picker-react": "^4.6.12",
"next": "13.5.6",
"react": "^18",
"react-dom": "^18"
Expand Down
12 changes: 11 additions & 1 deletion src/components/RandomEmoji.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { useState, useRef, useEffect } from "react";

export default function RandomEmoji() {
return <div>{getRandomEmoji()}</div>;
const [currentEmoji, setCurrentEmoji] = useState(getRandomEmoji());

useEffect(() => {
setTimeout(() => {
setCurrentEmoji(getRandomEmoji());
}, 150) as unknown as number;
}, [currentEmoji]);

return <div suppressHydrationWarning>{currentEmoji}</div>;
}

function getRandomEmoji() {
Expand Down
9 changes: 2 additions & 7 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ import dynamic from "next/dynamic";
import Link from "next/link";
import { Analytics } from "@vercel/analytics/react";
import pkg from "../../package.json";

const PickerDemo = dynamic(() => import("../components/PickerDemo"), {
ssr: false,
});
const RandomEmoji = dynamic(() => import("../components/RandomEmoji"), {
ssr: false,
});
import PickerDemo from "../components/PickerDemo";
import RandomEmoji from "../components/RandomEmoji";

const inter = Inter({ subsets: ["latin"] });

Expand Down

0 comments on commit 65cd3e9

Please sign in to comment.