我不明白为什么在数组状态项中使用spread运算符时组件只能重新呈现如下:const [openList, setOpenList] = React.useStateconsole.log(newOpenList) // prints the same in both options}
我在render()中使用了console.log (可能有更好的方法来了解组件是否使用钩子更新),并且只有<
问题是,thatI还想在列表的末尾添加一个按钮(就像列表中始终存在的最后一项),这样,如果此人正在寻找的项不存在,则此人可以单击该按钮来添加新项。这是一个相同的问题,并且得到了回答,但是对于react-select,我在material-ui的API中找不到任何东西来做同样的事情。Append a button at the end of options in react-select 一个例子(取自上面的问题):https://i