react 的函数组件 自定义事件
项目 中 ice +react 的函数组件
自定义事件 :
changeDetails
// 父组件 import StateHistory from './stateHistory'; const [details, setDetails] = useState<boolean>(true); <StateHistory changeDetails={(bol) => setDetails(bol)} /> // 子组件 const StateHistory = (props) => {
<Button type="primary" shape="round" onClick={() => props.changeDetails(true)} > 返回 </Button>
};
export default StateHistory;