Skip to content

Commit

Permalink
Update App.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
nuoxoxo authored Oct 29, 2023
1 parent 87731e6 commit 8d037bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ function App() {
*/

const [route, setRoute] = useState<string>(() => {
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));
Expand Down

0 comments on commit 8d037bb

Please sign in to comment.