You are given a basic markup and the API.
Implement the app to manage post comments.
Don't use class components. Use React Hooks instead.
- Create an
/src/api/posts.ts
and add a methodgetUserPosts(userId)
there - Load posts and show them using the
PostsList
on page load. (useuseEffect
as acomponentDidMount
) - Implement the UserSelect to show only the posts of the selected user. (call
getUserPosts
each time when user changes) - Each post has an
Open
button that sets aselectedPostId
in theApp
. - After opening the details the
Open
button becomesClose
and will close the details onclick. PostDetails
component should be shown only after selecting a post.- Create
getPostDetails(postId)
method in/src/api/posts.ts
and load post details from/posts/:postId
- Create
getPostComments(postId)
method in/src/api/comments.ts
, load comments from/comments
and filter them using a givenpostId
- Add a button to
show
/hide
comments. - Add an
X
button near each comment to delete it on the server. - Add a form to add a new comment to the current post
- Comments should be immediately updated after adding or removing.