Xinyuan Wang

Results 79 comments of Xinyuan Wang

## React 18 与 Concurrent Mode 对于React来说,有两类瓶颈需要解决: CPU的瓶颈,如大计算量的操作导致页面卡顿 IO的瓶颈,如请求服务端数据时的等待时间 其中CPU的瓶颈通过并发特性的优先级中断机制解决。 IO的瓶颈则交给Suspense解决。

react fiber 移除 Effect List 依赖 https://github.com/facebook/react/pull/19673/files

## 最精简版 react hooks 实现 ```js let state = []; let setters = []; let firstRun = true; let cursor = 0; function createSetter(cursor) { return function setterWithCursor(newVal) { state[cursor]...

react因为先天的不足——无法精确更新,所以需要react fiber把组件渲染工作切片;而vue基于数据劫持,更新粒度很小,没有这个压力; react fiber这种数据结构使得节点可以回溯到其父节点,只要保留下中断的节点索引,就可以恢复之前的工作进度;

NodeJS 检测 VSCode 是否安装 ```js const os = require('os'); const { exec } = require('child_process'); if (os.platform() === 'win32' || os.platform() === 'darwin' || os.platform() === 'linux') { exec('code --version',...

## node 性能优化 #3 nodejs 服务端部署资源利用问题 #2 Nodejs 并发测试

## dotenv配置与使用 ```shell $ npm install dotenv --save-dev ``` 使用 config ```js const envConfig = dotenv.config({ path: path.resolve(__dirname, '../.env'), // 配置文件路径 encoding: 'utf8', // 编码方式,默认utf8 debug: false, // 是否开启debug,默认false }).parsed;...

## Mock 服务方案 ### 使用 Json-server 模拟后端 [https://github.com/typicode/json-server](https://github.com/typicode/json-server) ### 使用 service worker 模拟后端 [https://github.com/mswjs/msw](https://github.com/mswjs/msw)

nodejs 底层原理 https://mp.weixin.qq.com/s/aEWdYiu7WWtchSw4G0vhRQ