import { Box, Button, Card, TextField, Typography } from "@mui/material";
import React, { useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import {addPost} from "./posts.store"
import moment from "moment";
import("./index.scss");
export default function General(){
const posts = useSelector((state) => state.generalposts.posts)
return <>
Assemble
{posts.map(({id,date,context}) => {
return
})}
>
};
function CreateNewPost()
{
const dispatch = useDispatch()
const [text, setText] = useState("");
function clickEvent()
{
dispatch(addPost(text));
setText("");
}
return
setText(event.target.value) }
/>
}
function PostTemplete({id, date, context})
{
return
Abdussamed ULUTAŞ
{context}
}
function RevokeTiming({date})
{
let [text, setText] = useState([,]);
function update()
{
setText([
moment(date).format("HH:mm:ss DD/MM/YYYY"),
moment(date).locale("tr").fromNow(false)
])
}
useEffect(()=>{
update();
let timer = setInterval( update, 30_000)
return () => clearInterval(timer)
},[]);
return
{text[1]} yayımladı
}