📜  反应钩子切换状态 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:16.938000             🧑  作者: Mango

代码示例2
// import React, { useState } from 'react';
const { useState } = React;

function App() {
  const [checked, setChecked] = useState(false);
  const toggleChecked = () => setChecked(value => !value);
  return (
    
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(, rootElement);