Skip to content

Commit acefd8f

Browse files
committed
yarn format updates
1 parent 522f9fa commit acefd8f

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

src/App.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@ import "./App.css";
33

44
import useAppState from "./useAppState";
55

6-
76
function App() {
87
const [state, dispatch] = useAppState();
98

109
useEffect(() => {
11-
fetch("pokemon.txt").then(response => response.text())
12-
.then(text => {
13-
setTimeout(() =>
14-
dispatch({
15-
type: "load-data",
16-
wordPack: text.split("\n").map(word => word.toLowerCase().trim()).filter(Boolean),
17-
}),
18-
3000,
19-
);
20-
});
21-
}, [dispatch])
10+
fetch("pokemon.txt")
11+
.then((response) => response.text())
12+
.then((text) => {
13+
setTimeout(
14+
() =>
15+
dispatch({
16+
type: "load-data",
17+
wordPack: text
18+
.split("\n")
19+
.map((word) => word.toLowerCase().trim())
20+
.filter(Boolean),
21+
}),
22+
3000,
23+
);
24+
});
25+
}, [dispatch]);
2226

2327
switch (state.phase) {
2428
case "pre-game": {
2529
if (state.wordPack === null) {
26-
return (
27-
<div>
28-
Loading Data...
29-
</div>
30-
)
30+
return <div>Loading Data...</div>;
3131
} else {
3232
return (
3333
<div>

src/useAppState.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function reducer(state: State, action: Action): State {
4141
if (state.phase !== "pre-game") break;
4242
return {
4343
...state,
44-
wordPack: action.wordPack
44+
wordPack: action.wordPack,
4545
};
4646
case "start-game":
4747
if (state.phase === "in-game") break;
@@ -50,7 +50,7 @@ function reducer(state: State, action: Action): State {
5050
phase: "in-game",
5151
goal: getRandomWord(state),
5252
guess: "",
53-
wordPack: state.wordPack
53+
wordPack: state.wordPack,
5454
};
5555
case "update-guess":
5656
if (state.phase !== "in-game") break;
@@ -59,7 +59,7 @@ function reducer(state: State, action: Action): State {
5959
return {
6060
phase: "post-game",
6161
goal: state.goal,
62-
wordPack: state.wordPack
62+
wordPack: state.wordPack,
6363
};
6464
}
6565
return {
@@ -72,5 +72,5 @@ function reducer(state: State, action: Action): State {
7272
}
7373

7474
export default function useAppState(): [State, Dispatch<Action>] {
75-
return useReducer(reducer, null, getInitialState);
76-
}
75+
return useReducer(reducer, null, getInitialState);
76+
}

0 commit comments

Comments
 (0)