用来改变数据
在 https://ant.design/components/button-cn 打开一个codesanbox替换
import React, { useState } from "react";
import "./index.css";
import { Button, Flex } from "antd";
const App: React.FC = () => {
const [data, setData] = useState({ a: 1, b: 2 });
return (
<Flex gap="small" wrap="wrap">
a: {data.a}
<br />
b: {data.b}
<button
onClick={() => {
setData({ ...data, b: data.b + 502 });
}}
>
修改数据
</button>
</Flex>
);
};
export default App;