From da7fe85c81d5602b71dfee9b5bda4e31078a8f26 Mon Sep 17 00:00:00 2001 From: Bochkovskyi Date: Mon, 25 Sep 2023 21:09:32 +0300 Subject: [PATCH] remove useState and useEffect --- src/components/message.jsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/components/message.jsx b/src/components/message.jsx index 5dedae5..977a9ed 100644 --- a/src/components/message.jsx +++ b/src/components/message.jsx @@ -1,16 +1,10 @@ -import { useEffect, useState } from 'react' import { timeFormatter } from '@/utils/getFormattedDate' import Image from 'next/image' import Link from 'next/link' export default function Message({ sentAt, children }) { - const [time, setTime] = useState(0) const { format: formatTime } = timeFormatter() - useEffect(() => { - setTime(formatTime(sentAt)) - }, [sentAt, formatTime]) - return (
@@ -24,7 +18,7 @@ export default function Message({ sentAt, children }) {

{children}

- {time} + {formatTime(sentAt)}
)