edwin-chalmers / destination-banana

https://destination-banana.vercel.app
0 stars 2 forks source link

Add resetGame function #80

Closed edwin-chalmers closed 4 months ago

edwin-chalmers commented 4 months ago

Added:

Add resetGame()

function resetGame() {
    setNextId(1);          // Resets the nextId to 1 
    setPages([]);          // Clears the pages array
    fetchWikiData();       // Fetch new data for the new game
    setStartTitle('');     // Clears the start title to trigger new game 
    setWin(false);         // Reset the win state
}

Todo:

It almost works sans two issues:

  1. The first is when you start a new game, the first new card continues the card counter, and then the following card is 2.
  2. When you start a new game, it gives you the starting page of the previous game rather than generating a new one.
vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
destination-banana ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 10, 2024 4:09am