home.tsx 769 B

1234567891011121314151617181920212223242526272829303132333435
  1. import styles from './index.less';
  2. import { Layout, Menu } from 'antd';
  3. import { useState } from 'react';
  4. const { SubMenu } = Menu;
  5. const { Header, Content, Sider } = Layout;
  6. export default function IndexPage() {
  7. const [value, setValue] = useState(0);
  8. const complexIncrease = () => {
  9. setTimeout(() => {
  10. setValue(value + 1)
  11. },0)
  12. }
  13. return (
  14. <>
  15. <section>
  16. <h2>计数器</h2>
  17. <h3>{value}</h3>
  18. <button>-</button>
  19. <button onClick={() => setValue(value+1)}>+</button>
  20. </section>
  21. <section>
  22. <h2>计数器</h2>
  23. <h3>{value}</h3>
  24. <button onClick={complexIncrease}>延迟</button>
  25. </section>
  26. </>
  27. // <Layout>
  28. // <span>home</span>
  29. // </Layout>
  30. );
  31. }