Skip to content

Commit dce6dd3

Browse files
committed
Completed exercise jonasschmedtmann#10: React Quiz in section 16 of the course
1 parent a18c8a0 commit dce6dd3

32 files changed

+4642
-67
lines changed

07-usepopcorn/starter/src/App-v1.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Loader from "./components/Loader";
1111
import ErrorMessage from "./components/ErrorMessage";
1212
import MovieDetails from "./components/Main/MovieDetails";
1313

14-
const KEY = "5cac9c17";
14+
const KEY = "";
1515

1616
export default function App() {
1717
const [query, setQuery] = useState("spider");

07-usepopcorn/starter/src/App-v2.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import MovieDetails from "./components/Main/MovieDetails";
1313
import { useMovies } from "./useMovies";
1414
import { useLocalStorageState } from "./useLocalStorageState";
1515

16-
// const KEY = "5cac9c17";
16+
// const KEY = "";
1717

1818
export default function App() {
1919
const [query, setQuery] = useState("shutter");

07-usepopcorn/starter/src/components/Main/MovieDetails.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Loader from "../Loader";
33
import StarRating from "../StarRating";
44
import { useKey } from "../../useKey";
55

6-
const KEY = "5cac9c17";
6+
const KEY = "";
77

88
const MovieDetails = ({ selectedId, onCloseMovie, onAddWatched, watched }) => {
99
const [movie, setMovie] = useState({});

07-usepopcorn/starter/src/useMovies.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect, useState } from "react";
22

3-
const KEY = "5cac9c17";
3+
const KEY = "";
44

55
export const useMovies = (query, callback) => {
66
const [movies, setMovies] = useState([]);
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: [
5+
"eslint:recommended",
6+
"plugin:react/recommended",
7+
"plugin:react/jsx-runtime",
8+
"plugin:react-hooks/recommended",
9+
],
10+
ignorePatterns: ["dist", ".eslintrc.cjs"],
11+
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
12+
settings: { react: { version: "18.2" } },
13+
plugins: ["react-refresh"],
14+
rules: {
15+
"react/jsx-no-target-blank": "off",
16+
"react-refresh/only-export-components": [
17+
"warn",
18+
{ allowConstantExport: true },
19+
],
20+
"react/prop-types": "off",
21+
},
22+
};

10-react-quiz/starter/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

10-react-quiz/starter/DateCounter.js

Lines changed: 0 additions & 61 deletions
This file was deleted.

10-react-quiz/starter/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# React + Vite
2+
3+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4+
5+
Currently, two official plugins are available:
6+
7+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
File renamed without changes.

10-react-quiz/starter/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link rel="icon" href="logo512.png" />
7+
<title>App Quiz</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)