logo
publist
写文章

简介

该用户还未填写简介

擅长的技术栈

可提供的服务

暂无可提供的服务

ts(TypeScript)常用语法(Omit、Pick、Partial、Required)

ts(TypeScript)常用语法比如有一个联系人列表export interface Contact{name: string; // 姓名phone?: string; // 手机号email?: string; // 邮箱avatar: string; // 头像userid: string; // id}1.去除类型中某些项(官方提供)现在需要定义一个新的数据类型,新的联系人列表没有邮箱

#typescript#javascript#前端
ts(TypeScript)定义服务器返回数据类型

ts(TypeScript)定义服务器返回数据类型1.定义基本返回类型export type JSONResponse = {stat: string;msg?: string;};stat:状态msg:提示信息(msg后面的?问号表示该参数是可选的,服务器可能返回,也可能不返回)2.服务器返回为多个同类型数据时先定一个返回的泛型export type Rows<T extends any&

#typescript#服务器#javascript
useState、useEffect笔记

Hook APIuseState的两种用法function Counter({initialCount}) {const [count, setCount] = useState(initialCount);return (<>Count: {count}<button onClick={() => setCount(initialCount)}>Reset</

到底了