We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qwerty-learner/src/pages/Typing/components/WordPanel/components/Word/index.tsx
Line 227 in fafb553
这里的dispath在setState回调函数中才被调用,导致在dispatch后,组件已经被销毁。
解决方案,直接在useEffect内调用dispatch
} else { // 出错时 playBeepSound() const letterMistake = structuredClone(wordState.letterMistake ) if (letterMistake[inputLength - 1]) { letterMistake[inputLength - 1].push(inputChar) } else { letterMistake[inputLength - 1] = [inputChar] } dispatch({ type: TypingStateActionType.REPORT_WRONG_WORD, payload: { letterMistake } }) setWordState((state) => { state.letterStates[inputLength - 1] = 'wrong' state.hasWrong = true state.hasMadeInputWrong = true state.wrongCount += 1 state.letterTimeArray = [] }) if (currentChapter === 0 && state.chapterData.index === 0 && wordState.wrongCount >= 3) { setShowTipAlert(true) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
qwerty-learner/src/pages/Typing/components/WordPanel/components/Word/index.tsx
Line 227 in fafb553
这里的dispath在setState回调函数中才被调用,导致在dispatch后,组件已经被销毁。
解决方案,直接在useEffect内调用dispatch
The text was updated successfully, but these errors were encountered: