This commit is contained in:
QkoSad
2023-08-08 16:02:54 +03:00
commit 0a7a469d56
315 changed files with 426907 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import { useEffect } from "react";
import { useSelector } from "react-redux";
import { useParams, Link } from "react-router-dom";
const User = () => {
const id = useParams().id;
const users = useSelector((state) => state.users);
const user = users.find((el) => el.id === id);
const blogs = useSelector((state) => state.blogs);
const userBlogs = blogs.filter(el=> el.user.id === user.id)
useEffect(() => {});
return (
<>
<h2>{user.name}</h2>
<h3>added blogs</h3>
<ul>
{userBlogs.map((blog, index) => (
<li key={index}>
<Link to={`/blog/${blog.id}`}>{blog.title}</Link>
</li>
))}
</ul>
</>
);
};
export default User;