我尝试在状态对象中的menuHistory键下存储一个字符串数组,当页面更改props.location更新时,我用'first‘初始化它,这会触发useEffect(),然后我会尝试将位置推入数组。我得到的错误是..Type 'number' is not assignable to type 'string[]'.ts(2345) import React, {useEffect, useState} from
我得到了一个项目,在这个项目中,我将单词从不同的输入字段中分离出来,并将它们推送到content数组中。数组应该“记住”被推入其中的所有单词。目前,每当用户开始输入“新”(和空)输入字段时,content数组就会被清除,因为值是空的。import { useState } from "react";
export default f