随笔分类 - 前端jira-hook学习笔记
前端jira-hook学习笔记
摘要:在Typescript中,表示断言有两种方式。一种是扩号表示法: let someValue: any = "this is a string"; let strLength: number = (someValue).length; 另一种使用as关键字: let someValue: any =
阅读全文
摘要:Object.fromEntries() 方法把键值对列表转换为一个对象。 const entries = new Map([ ['foo', 'bar'], ['baz', 42] ]); const obj = Object.fromEntries(entries); console.log(o
阅读全文
摘要:2-1、要求 自定义一个useArray的custom hook。结合react-hook和typescript,实现对数组简单的增加、删除、清空的那个功能,并且对增加的对象类型有限制 2-2、代码实现 export const useDebounce = (value, delay) => { c
阅读全文
摘要:自定义hook export const useMount = (callback: () => void) => { useEffect(() => { callback(); }, [callback]); };
阅读全文
摘要:export const isVoid = (value: unknown) => value undefined || value null || value ""; // let a: object // a = {name: 'jack'} // a = () => { // } // a =
阅读全文
摘要:const SearchList = ({ lists, users }) => { return ( <table> <thead> <tr> <th>项目</th> <th>负责人</th> </tr> </thead> <tbody> { lists.map(project => <tr> <
阅读全文
摘要:解码和转码 const SearchPannel = ({ users, param, setParam }) => { return ( <form> <div> <input type="text" value={param.name} onChange={evt => setParam({ .
阅读全文
摘要:// Object 跟我们在JS中想象的对象是有一定差别的 // Object类型 可以是 对象 函数 正则 let a: Object a = {name: 'hky'} a = () => {} a = new RegExp('') let b:{[key:string]: unknown} b
阅读全文
摘要:export interface Project { id: number; name: string; personId: number; pin: boolean; organization: string; created: number; } interface ISearchListPro
阅读全文
摘要:return keys.reduce((pre, key) => { console.log(" 6 ") console.log(key, "keys") console.log(searchParams.get(key), "keysValue") console.log({ ...pre, [
阅读全文
摘要:
阅读全文
摘要:const User = () => { const { logout, user } = useAuth(); return ( <Dropdown overlay={ <Menu> <Menu.Item key={"logout"}> <Button onClick={logout} type=
阅读全文
摘要:import React from "react"; import { useTasksSearchParams } from "screens/kanban/util"; import { useSetUrlSearchParam } from "utils/url"; import { Row
阅读全文