把下面代码改成函数式组件
import React, { useState } from "react";
const MyComponent = () => {
const [count, setCount] = useState(0);
const incrementCount = () => {
setCount(count + 1);
};
return (
<div>
<p>Count: {count}</p>
<button onClick={incrementCount}>Increment</button>
</div>
);
};
export default MyComponent;
原文地址: https://www.cveoy.top/t/topic/iyHZ 著作权归作者所有。请勿转载和采集!