diff --git a/src/App.tsx b/src/App.tsx index eedd0ef..ee76b38 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -58,11 +58,12 @@ function App() { */ const [route, setRoute] = useState(() => { + const len = Object.keys(routes).length const initialRoute = routeFromLocalStorage ? JSON.parse(routeFromLocalStorage) : Object.keys(routes)[ - Math.floor(Math.random() * Object.keys(routes).length) + Math.floor(Math.random() * len /*Object.keys(routes).length*/) ] // handleSetRoute(initialRoute) // hoisting seems wrong in strictMode localStorage.setItem("route", JSON.stringify(initialRoute));