- 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.ts
and add a methodgetUserPosts(userId)
there. - Load
posts
and show them using thePostsList
on page load (useuseEffect
as acomponentDidMount
). You should adddata-cy="postDetails"
attribute to thePostsList
<ul>
or<ol>
element. - Implement the
UserSelect
to show only theposts
of the selected user. (callgetUserPosts
each time when user changes). post
should containtitle
of the post.- Each
post
has anOpen
button that sets aselectedPostId
in theApp
. - After opening the details the
Open
button becomesClose
and will close the details on click. - You should add
data-cy="postDetails"
attribute to the element containing post comments. PostDetails
component should be shown only after selecting apost
.- 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?postId={postId}
. - Add a button to
show
/hide
comments, which should have the nameShow comments
/Hide comments
respectively. - 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 comment
in 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.