TypeError: Invalid attempt to destructure non-iterable instance. On React Native
TypeError: Invalid attempt to destructure non-iterable instance. On React Native
由于这一行,我收到一个错误 const [guesses, setGuesses] = React.useState < IGuess > defaultGuess;
在 Vscode 上显示 Operator '>' cannot be applied to types 'boolean' and 'IGuess'.ts(2365)
****
interface IGuess {
[key: number]: string;
}
const defaultGuess: IGuess = {
0: '',
1: '',
2: '',
3: '',
4: '',
5: '',
};
export default function App() {
const [guesses, setGuesses] = React.useState < IGuess > defaultGuess;
*****
你需要改成这个
const [guesses, setGuesses] = React.useState (defaultGuess)
由于这一行,我收到一个错误 const [guesses, setGuesses] = React.useState < IGuess > defaultGuess;
在 Vscode 上显示 Operator '>' cannot be applied to types 'boolean' and 'IGuess'.ts(2365)
****
interface IGuess {
[key: number]: string;
}
const defaultGuess: IGuess = {
0: '',
1: '',
2: '',
3: '',
4: '',
5: '',
};
export default function App() {
const [guesses, setGuesses] = React.useState < IGuess > defaultGuess;
*****
你需要改成这个
const [guesses, setGuesses] = React.useState (defaultGuess)