摘要: 参考链接 https://zh-hans.reactjs.org/docs/hooks-reference.html#useeffect 阅读全文
posted @ 2022-10-19 20:20 yurro 阅读(22) 评论(0) 推荐(0)
摘要: 出现这个错误是因为我在mac用了brew install 安装,导致目录webstorm查找不到。 可以使用npm install -g yarn ,webstorm就可以找到yarn https://blog.csdn.net/qq_30290061/article/details/1274113 阅读全文
posted @ 2022-10-19 16:45 yurro 阅读(569) 评论(0) 推荐(0)
摘要: 参考链接 https://github.com/typicode/json-server 1. npm i json-server -D 或者 yarn add json-server --dev 创建一个jsonserver的目录,这个目录下创建db.json { "user":[] } json 阅读全文
posted @ 2022-10-18 16:49 yurro 阅读(49) 评论(0) 推荐(0)
摘要: 一, yarn add --dev --exact prettier 二, echo {}> .prettierrc.json 三, prettier.json 文件添加 build coverage 四, yarn add eslint-config-prettier -D 在package.js 阅读全文
posted @ 2022-10-17 21:23 yurro 阅读(173) 评论(0) 推荐(0)
摘要: 其根本原因就是JavaScript是单线程的,那么和react提出Cocurrent类似的概念就是Promise异步?我们并不能同时做两件事 而是一件事开始后先onhold 然后处理另外一件事 最后返回头再来处理前面on hold的事情 原处 https://coding.imooc.com/lea 阅读全文
posted @ 2022-10-12 20:41 yurro 阅读(26) 评论(0) 推荐(0)
摘要: 1: useState的值在每个rernder中都是独立存在的。而useRef.current则更像是相对于render函数的一个全局变量,每次他会保持render的最新状态。这种关系更像是js一个经典的案例:for循环中异步打印i的值,let声明的i就相当于每个都是独立作用域,互相之间不会干扰。v 阅读全文
posted @ 2022-10-12 12:34 yurro 阅读(435) 评论(0) 推荐(0)
摘要: //type aliasestype PlusType = (x: number, y: number) => number;function sum(x: number, y: number): number { return x + y;}const sum2: PlusType = sum;t 阅读全文
posted @ 2022-10-09 15:22 yurro 阅读(37) 评论(0) 推荐(0)
摘要: 动态定义数据类型,可以使用泛型<T> 阅读全文
posted @ 2022-10-08 19:29 yurro 阅读(14) 评论(0) 推荐(0)
摘要: typescript 函数中的可选参数,参数默认值 必须在末尾 function bird(name: string, age: number = 0){ console.log(age) } //替换age默认值 bird("jessi",5) //使用age参数默认值 bird("jessi") 阅读全文
posted @ 2022-10-07 21:19 yurro 阅读(67) 评论(0) 推荐(0)
摘要: service nginx restart 阅读全文
posted @ 2022-10-05 22:46 yurro 阅读(27) 评论(0) 推荐(0)