|
@@ -1,10 +1,10 @@
|
|
-import { useState, useEffect, useRef, forwardRef } from "react";
|
|
|
|
|
|
+import { useRef, forwardRef } from "react";
|
|
import { CSSTransition } from "react-transition-group";
|
|
import { CSSTransition } from "react-transition-group";
|
|
import { dispatch } from "../../../domain/gameStore";
|
|
import { dispatch } from "../../../domain/gameStore";
|
|
-import { hasSavedGameInfo } from "../../../domain/localStorageMethods";
|
|
|
|
import DelayedButton from "../../util/DelayedButton";
|
|
import DelayedButton from "../../util/DelayedButton";
|
|
import GameCreationForm from "../../util/GameCreationForm";
|
|
import GameCreationForm from "../../util/GameCreationForm";
|
|
import styles from "./HomePage.module.css";
|
|
import styles from "./HomePage.module.css";
|
|
|
|
+import useHasSavedInfo from "./useHasSavedInfo";
|
|
|
|
|
|
export const Rejoin = forwardRef((_, ref) => (
|
|
export const Rejoin = forwardRef((_, ref) => (
|
|
<div className={styles.rejoinSection} ref={ref}>
|
|
<div className={styles.rejoinSection} ref={ref}>
|
|
@@ -21,10 +21,7 @@ export const Rejoin = forwardRef((_, ref) => (
|
|
));
|
|
));
|
|
|
|
|
|
const HomePage = () => {
|
|
const HomePage = () => {
|
|
- const [hasSavedInfo, setHasSavedInfo] = useState(false);
|
|
|
|
- useEffect(() => {
|
|
|
|
- hasSavedGameInfo().then(setHasSavedInfo);
|
|
|
|
- }, []);
|
|
|
|
|
|
+ const hasSavedInfo = useHasSavedInfo();
|
|
const transitionRef = useRef(null);
|
|
const transitionRef = useRef(null);
|
|
|
|
|
|
return (
|
|
return (
|