As per the requirement, I will implement the feature to order the comments according to the number of upvotes, downvotes, and user type. The comments with more upvotes will be displayed first, followed by the comments with equal upvotes and fewer downvotes. Also, the comments with expert user type always will have top priority and are displayed as the first comments.
Steps:
1) Create a new function called sortComments that takes in an array of comments and returns a new sorted array of comments.
2) In the CommentBox component, call the sortComments function and pass in the comments array as an argument.
3) Replace the sorted array with the previous API response array in the render function.
Description:
As per the requirement, I will implement the feature to order the comments according to the number of upvotes, downvotes, and user type. The comments with more upvotes will be displayed first, followed by the comments with equal upvotes and fewer downvotes. Also, the comments with expert user type always will have top priority and are displayed as the first comments.
Steps:
1) Create a new function called sortComments that takes in an array of comments and returns a new sorted array of comments. 2) In the CommentBox component, call the sortComments function and pass in the comments array as an argument. 3) Replace the sorted array with the previous API response array in the render function.
Reviewer: @umutdenizsenerr Deadline: 27.12.2022 08.00 A.M