09 2024 档案

摘要:接口概念:接口主要是做类型规范约束,在进行传值的时候必须按照接口规范类型 接口语法: interface 接口名 { xxx } 例: interface Person{ name:string } // 定义一个接口 此处定义规范 interface IPerson{ firstName : st 阅读全文
posted @ 2024-09-27 11:01 尼古拉斯-富贵 阅读(202) 评论(0) 推荐(0) 编辑
摘要:useContext 概念:useContext 创建上下文,主要是解决组件跨级通信、传值 示例: 步骤1、使用 creatContext 方法创建一个 context 实例对象(通常在组件树的顶层) import React from 'react'; const MyContext = Reac 阅读全文
posted @ 2024-09-27 10:14 尼古拉斯-富贵 阅读(44) 评论(0) 推荐(0) 编辑
摘要:一、useMemo 概念:useMemo 主要用于性能优化,减少不必要的计算,返回一个 计算结果(一般情况下会是非常耗性能的复杂计算,有点像vue 里的 computed 计算属性) 用法: const mapResult = useMemo(()=>{ return ( Arr.map(item 阅读全文
posted @ 2024-09-19 10:57 尼古拉斯-富贵 阅读(840) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示