Create a Like button which appearance changes based on the following states:
The heart and spinner icons are provided for your convenience. The focus of this question is on the handling of the various states, not so much on being pixel perfect. As for colors, you can use #f00
for the red and #888
for the gray.
https://questions.greatfrontend.com/api/questions/like-button
POST
json
The following fields are accepted in the request body:
action
: A string of either 'like'
or 'unlike'
depending on the desired action.The API has a 50% chance of succeeding (HTTP 200) or failing (HTTP 500) so as to make it easy for you to test the request failure cases. It returns a JSON payload of the following shape depending on the outcome.
{ message: 'Success!' }
{ message: 'Unknown error during attempted {{action}}. Please try again later.!' }
Nothing screams React struggle like debugging infinite re-renders. This sleek black tee pays tribute to every front end dev's favorite hook — the one that either saves your app or breaks everything. Perfect for React engineers who live in the dependency array.
Nothing screams React struggle like debugging infinite re-renders. This sleek black tee pays tribute to every front end dev's favorite hook — the one that either saves your app or breaks everything. Perfect for React engineers who live in the dependency array.
Create a Like button which appearance changes based on the following states:
The heart and spinner icons are provided for your convenience. The focus of this question is on the handling of the various states, not so much on being pixel perfect. As for colors, you can use #f00
for the red and #888
for the gray.
https://questions.greatfrontend.com/api/questions/like-button
POST
json
The following fields are accepted in the request body:
action
: A string of either 'like'
or 'unlike'
depending on the desired action.The API has a 50% chance of succeeding (HTTP 200) or failing (HTTP 500) so as to make it easy for you to test the request failure cases. It returns a JSON payload of the following shape depending on the outcome.
{ message: 'Success!' }
{ message: 'Unknown error during attempted {{action}}. Please try again later.!' }
Nothing screams React struggle like debugging infinite re-renders. This sleek black tee pays tribute to every front end dev's favorite hook — the one that either saves your app or breaks everything. Perfect for React engineers who live in the dependency array.
console.log()
statements will appear here.