2022年10月6日

插槽

摘要: function App() { const name = 'Comp Name' return ( <Comp name={name}> <div slot="s1">solt1</div> <div slot="s2">solt2</div> </Comp> ) } import { React 阅读全文

posted @ 2022-10-06 23:32 In-6026 阅读(17) 评论(0) 推荐(0) 编辑

通信

摘要: ##props ###函数(标签上传递,参数接收) interface IProps { name: string } interface IState {} function Comp(props: IProps) { const [state, setState] = useState<ISta 阅读全文

posted @ 2022-10-06 23:27 In-6026 阅读(21) 评论(0) 推荐(0) 编辑

受控组件,双向绑定

摘要: class Comp extends React.COmponent { state = { value: '' } change = (e) => { this.setState({ value = e.target.value }) } render() { return <input valu 阅读全文

posted @ 2022-10-06 17:28 In-6026 阅读(15) 评论(0) 推荐(0) 编辑

导航