摘要: export const useDebounce = <V>(value: V, delay?: number) => { const [debouncedValue, setDebouncedValue] = useState(value); useEffect(() => { // 每次在val 阅读全文
posted @ 2022-10-07 18:44 前端导师歌谣 阅读(9) 评论(0) 推荐(0)
摘要: // const debounce = (func, delay) => { // let timeout; // return (...param) => { // if (timeout) { // clearTimeout(timeout); // } // timeout = setTime 阅读全文
posted @ 2022-10-07 18:44 前端导师歌谣 阅读(21) 评论(0) 推荐(0)
摘要: 自定义hook export const useMount = (callback: () => void) => { useEffect(() => { callback(); }, [callback]); }; 阅读全文
posted @ 2022-10-07 18:44 前端导师歌谣 阅读(6) 评论(0) 推荐(0)
摘要: export const isVoid = (value: unknown) => value undefined || value null || value ""; // let a: object // a = {name: 'jack'} // a = () => { // } // a = 阅读全文
posted @ 2022-10-07 18:44 前端导师歌谣 阅读(13) 评论(0) 推荐(0)
摘要: const SearchList = ({ lists, users }) => { return ( <table> <thead> <tr> <th>项目</th> <th>负责人</th> </tr> </thead> <tbody> { lists.map(project => <tr> < 阅读全文
posted @ 2022-10-07 18:44 前端导师歌谣 阅读(24) 评论(0) 推荐(0)
摘要: 解码和转码 const SearchPannel = ({ users, param, setParam }) => { return ( <form> <div> <input type="text" value={param.name} onChange={evt => setParam({ . 阅读全文
posted @ 2022-10-07 18:44 前端导师歌谣 阅读(13) 评论(0) 推荐(0)
摘要: // Object 跟我们在JS中想象的对象是有一定差别的 // Object类型 可以是 对象 函数 正则 let a: Object a = {name: 'hky'} a = () => {} a = new RegExp('') let b:{[key:string]: unknown} b 阅读全文
posted @ 2022-10-07 18:44 前端导师歌谣 阅读(34) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="wi 阅读全文
posted @ 2022-10-07 18:44 前端导师歌谣 阅读(18) 评论(0) 推荐(0)
摘要: export interface Project { id: number; name: string; personId: number; pin: boolean; organization: string; created: number; } interface ISearchListPro 阅读全文
posted @ 2022-10-07 18:44 前端导师歌谣 阅读(7) 评论(0) 推荐(0)
摘要: return keys.reduce((pre, key) => { console.log(" 6 ") console.log(key, "keys") console.log(searchParams.get(key), "keysValue") console.log({ ...pre, [ 阅读全文
posted @ 2022-10-07 18:44 前端导师歌谣 阅读(7) 评论(0) 推荐(0)