- Replace
<your_account>with your Github username in the DEMO LINK - Follow the React task guideline
- Use React TypeScript cheat sheet
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
postsand show them using thePostsListon page load (useuseEffectas acomponentDidMount). You should adddata-cy="postDetails"attribute to thePostsList<ul>or<ol>element. - Implement the
UserSelectto show only thepostsof the selected user. (callgetUserPostseach time when user changes). postshould containtitleof the post.- Each
posthas anOpenbutton that sets aselectedPostIdin theApp. - After opening the details the
Openbutton becomesCloseand will close the details on click. - You should add
data-cy="postList"attribute to the element containing post comments. PostDetailscomponent should be shown only after selecting apost.- 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/comments?postId={postId}. - Add a button to
show/hidecomments, which should have the nameShow comments/Hide commentsrespectively. - Add a delete button near each comment to delete it on the server using this symbol
X. - Add a form to add a new comment to the current post. The form should have a submit button with the name
Add a commentin it and 3 fields:
- for user name with the placeholder
Your name - for user email with the placeholder
Your email - for comment with the placeholder
Type comment here
- Comments should be immediately updated after adding or removing.