https://github.com/patryk-bernasiewicz/react-native-trivia-app
Simple React Native trivia game made as a part of recruitment process.
https://github.com/patryk-bernasiewicz/react-native-trivia-app
react react-native react-native-app redux
Last synced: 3 months ago
JSON representation
Simple React Native trivia game made as a part of recruitment process.
- Host: GitHub
- URL: https://github.com/patryk-bernasiewicz/react-native-trivia-app
- Owner: patryk-bernasiewicz
- Created: 2019-06-02T15:35:49.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T18:35:49.000Z (over 3 years ago)
- Last Synced: 2025-02-23T01:22:46.088Z (over 1 year ago)
- Topics: react, react-native, react-native-app, redux
- Language: JavaScript
- Homepage:
- Size: 2.43 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TriviaApp
An App that lets you find out how little you know about random stuff.
## Used packages
- [Expo](https://github.com/react-community/create-react-native-app) (it's now basically the same thing as create-react-native-app)
- [Redux](https://redux.js.org/) and [react-redux](https://redux.js.org/basics/usage-with-react)
- [redux-thunk](https://github.com/reduxjs/redux-thunk) - for easier asynchronous interactions with store
- [html-entities](https://github.com/mdevils/node-html-entities) - to parse HTML text from JSON data
## How it behaves
The _App.js_ only invokes the **TriviaApp** component and surrounds it with **react-redux**'s `Provider` component, so that we can use the Redux store throughout the whole application.
The store stores information about our questions, if the game is started or ended, and how many valid answers the user has given.
**TriviaApp** component decides which one of the child components should be rendered, depending on the information from Redux store. If the user hasn't started a new trivia game or there was an error fetching questions from the API, we stay in the **HelloScreen**. Otherwise, the **TriviaScreen** is displayed.
The **TriviaScreen** displays all questions one by one and lets user press _True_ or _False_ as an answer to the given question. After answering all questions, user is presented back the **HelloScreen**, but this time with their results.
If an error occurs (when the App can't reach the API), it's displayed on **HelloScreen** under the _Start Game_ button.
