Demo Page Here
The exercise is from the course - Learn React for free created by Bob Ziroll from Scriba.
In the website, an user can play a quiz game with 5 random questions provided by Open Trivia
In this exercise, I learned:
- Use
useState
to create variables, mutate them and let variables reactively change on web page. - Use
useEffect
to call external APIs to avoid side effects in React.js
- When using
useEffect
to fetch API's data, it will call API twice. It's because I turned on the "StrictMode". It will render components twice. Fortunately, it only runs in development mode. - Discussion on stackoverflow: React Hooks: useEffect() is called twice even if an empty array is used as an argument
- When a data is updated in a JSX, React will re-render the whole JSX. It will cause some problems if we want some datum be the same, like datum we fetch from APIs. Therefore, we have to handle the data update carefully.
- Solution URL: Quizzical
- Live Site URL: Live Demo
- The Layout Design URL: Quizzical App
- Use vite to create the project.
- Semantic HTML5 markup
- React - JS library
- tailwindcss - the utility-first CSS framework
- Medium - [Cassie,來學]](https://medium.com/@cassiecoding)
- Cake Resume - @SHANYU LIN
- Deploying Vite App to GitHub Pages by Shashank sharma