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.tsand add a methodgetUserPosts(userId)there - Load posts and show them using the
PostsListon page load. (useuseEffectas acomponentDidMount) - Implement the UserSelect to show only the posts of the selected user. (call
getUserPostseach time when user changes) - Each post has an
Openbutton that sets aselectedPostIdin theApp. - After opening the details the
Openbutton becomesCloseand will close the details onclick. PostDetailscomponent should be shown only after selecting a post.- Create
getPostDetails(postId)method in/src/api/posts.tsand load post details from/posts/:postId - Create
getPostComments(postId)method in/src/api/comments.ts, load comments from/commentsand filter them using a givenpostId - Add a button to
show/hidecomments. - Add an
Xbutton 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.