Your mission, if you choose to accept it, is to build out a mock of a product reviews flow. This includes a page for users to submit their reviews as well as a page to read reviews.
REQUIREMENTS:
- Create a page where a user can review a given product with the following information:
- Their name (the author)
- A star rating
- Headline text (a title for their review)
- The body of the review (a longer paragraph)
- Create a page where a user can view all of the reviews for a given product
Please spend 90 minutes completing this task to whatever extent you can finish, but don't go over time. The expectation is not that you will get through all of the requirements, so please add notes on anything else you would have done with more time. Feel free to use any third-party libraries that you find helpful.
Start the mock JSON server on port 3004 using json-server --watch db.json
Start the React app on port 3000 using npm start
You can then make requests to http://localhost:3004/products, http://localhost:3004/reviews or http://localhost:3004/products/:id/reviews using axios, or any of your preferred methods
More info on json-server here
This project was bootstrapped with Create React App.
- Honestly I spent a lot of time styling the app and I didnt have enough time to create a star rating component =( so I used a numeric input instead
- Add more navigation buttons
- Use a reducer or global state lib to set the selected product rather than fetching it several times
- Add more and nicer styles.. lol
- Add notifications to the user when a review is submitted
- Add validations to the form, maybe using FORMIK