mirror of
https://github.com/FranP-code/Hangman-game-with-React.git
synced 2025-10-13 00:42:32 +00:00
bug fixes
This commit is contained in:
@@ -48,7 +48,7 @@ function App() {
|
||||
document.title = titleAPP.spanish
|
||||
}
|
||||
|
||||
})
|
||||
}, [])
|
||||
|
||||
if (isVictory || isDefeat) {
|
||||
|
||||
|
||||
@@ -30,20 +30,6 @@ const PuzzleWord = ({hangmanFrame, setHangmanFrame, currentScore, setCurrentScor
|
||||
puzzleWord.appendChild(counter)
|
||||
}
|
||||
|
||||
const definePuzzle = async () => {
|
||||
|
||||
const words = await BringTheWords(language, category)
|
||||
const wordSelection = await SelectRandomWord(words)
|
||||
|
||||
const word = await words[wordSelection]
|
||||
|
||||
await setActualWord(word)
|
||||
|
||||
}
|
||||
if (!displayApp && !actualWord) {
|
||||
|
||||
definePuzzle()
|
||||
}
|
||||
|
||||
|
||||
if (actualWord && !displayApp) {
|
||||
@@ -58,6 +44,23 @@ const PuzzleWord = ({hangmanFrame, setHangmanFrame, currentScore, setCurrentScor
|
||||
|
||||
React.useEffect(() => {
|
||||
|
||||
const definePuzzle = async () => {
|
||||
|
||||
const words = await BringTheWords(language, category)
|
||||
const wordSelection = await SelectRandomWord(words)
|
||||
|
||||
const word = await words[wordSelection]
|
||||
|
||||
setActualWord(word)
|
||||
|
||||
}
|
||||
|
||||
if (!displayApp && !actualWord) {
|
||||
|
||||
definePuzzle()
|
||||
}
|
||||
|
||||
|
||||
if (displayApp) {
|
||||
|
||||
Register_Input(actualWord, hangmanFrame, setHangmanFrame, setIsVictory, setIsDefeat)
|
||||
|
||||
Reference in New Issue
Block a user