diff --git a/src/components/WordInput.js b/src/components/WordInput.js index 4bc6fb4fed428f9f3462995748088d841d13de13..60e4b658d153d2d17a4c0f553ec1bb14e24b6d21 100644 --- a/src/components/WordInput.js +++ b/src/components/WordInput.js @@ -133,10 +133,10 @@ const WordInput = () => { var correct = true; for (let i = 0; i < neededWord.length; i++) { - if (!word.includes(neededWord[i])) { + if (word[neededWord[i].index] !== neededWord[i].char) { setPopUp({ show: true, - text: "You need to use the letter that is already correct or misplaced in the word", + text: "You need to use the letter that is already correct in the word", buttonText: "Ok", buttonHandler: () => {}, }); @@ -151,8 +151,8 @@ const WordInput = () => { } if (isEnabled) { - if (e === "correct" || e === "misplaced") { - setNeededWord(prev => [...prev, word[idx]]) + if (e === "correct") { + setNeededWord(prev => [...prev, { char: word[idx], index: idx }]); } } });