import {Navbar, NavbarBrand} from 'reactstrap';
// import Menu from './components/MenuComponent';
import {DISHES} from "./shared/dishes";
export default function App() {
const [state, updateState] = useState({
dishes: DISHES
});
updateState({...state, name: 'something'});
console.log(state);
return (
<div>
<Navbar dark color="primary">
<div className="container">
<NavbarBrand href="/">Ristorante Con Fusion</NavbarBrand>
</div>
</Navbar>
{/*<Menu dishes={state.dishes}/>*/}
</div>
);
}
这导致了无限循环。在对 updateState 行发表评论后,它可以工作。通过作品,我的意思是它不会进入无限循环。有人可以告诉我我做错了什么吗?
下面附上截图——