‘Would you rather’ (GitHub) is an app built using React and Redux where the user has to choose between two answers. It stores the main data in the Redux store, which holds the user and questions state. The user can vote / select from one of two options relevant to the question. Upon doing so the selected question is highlighted and the overall number of votes and percentage is shown for each option.
The user can also create new questions, with two possible answers, which is then added to the list of available questions. As each question is answered that particular question is then displayed in the answered questions section. Each user is also ranked according to the number of questions asked and questions answered on the leaderboard screen.
I also added the extra functionality of being able to sign up a new user as well as log in as an existing user. If the requested username is already in use an alert is displayed and the user is asked to select a new username. The login also validates if the username and password match to the current list of users.
This App works across all major screen sizes and uses ‘react-router’ in order to navigate via url. However, due to the current ‘mocked’ back-end once the page is refreshed any newly created user is wiped from the store state and back-end.