- deployed online version: see demo
A simple React demo app where you can:
- log in as one of three predefined users (no password required)
- answer questions
- create new questions
- see counts and percentages of total answers
- see a leaderboard which ranks users by the aggregat of their total given answers and created questions
- log out to change your user
N.b.: new questions are not persisted and will disappear after a page reload. For more details, see REQUIREMENTS.
- when trying to access a question directly (e.g. http://localhost:3000/questions/am8ehyc8byjqgar0jgpub9) the user will first be asked to log in and after login the poll's page will open automatically
- Debug toolbox in the top right corner to change the API-Request delay so loading spinners can be inspected.
- cannot properly set a basename for the app to work on Github pages. It worked here: https://paulkoegel-wessels.github.io/myreads/, where we used the
BrowserRouter
. My suspicion is thatRouter
, which we use here so we can trigger URL changes imperatively viacustomHistory
, has a bug in itsbasename
implementation :(
- Install npm packages with:
$ yarn
- Start the development server with:
$ yarn start
- Should it not be opened automatically, open http://localhost:3000 in your browser.
yarn deploy
- General setup instructions I followed:https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#github-pages
- Configured React Router with a basename, see index.js and: facebook/create-react-app#1765 (comment)
- to get around the fact that Github doesn't offer a catchall route that redirect, e.g.
/search
to index.html, this app uses a workaround that redirects from a custom 404 page to an app URL. Sources: