blog icon indicating copy to clipboard operation
blog copied to clipboard

✏️blog. writing in issues.

Build Status author Node.js Version Size tested with jest jest

欢迎光临我的博客

本站托管于 Github,所有数据来源于ISSUE,通过 GitHub API 动态加载数据渲染页面

我的技术栈

  • JavaScript(React Vue)
  • Node
  • HTTP(http1.1 https http2)
  • RegExp
  • Nginx
  • Python
  • Graphql

TODO

  • [x] 引入 jest 单元测试,覆盖率>90%
    • reducer 测试
    • component 测试
    • container 测试
  • [ ] redux-saga 替代 redux-thunk
  • [ ] 将所有组件转化成 useState 函数式组件
  • [ ] 引入 typescript, 这样每个组件就都有提示了,非常爽

redux-thunk

使用redux-thunk原因在于下面报错内容,允许 action 返回一个函数.

Uncaught Error: Actions must be plain objects. Use custom middleware for async actions.

docker 构建项目

./build.sh # 用于构建image,镜像内部运行`yarn build`,构建的dist文件在镜像内部
./run.sh   # 用于运行镜像 `CMD serve -s dist` 运行服务

Interview Question ++

  • [ ] vue 与 react 区别
  • [ ] 观察者模式与发布订阅模式的区别
  • [ ] 什么情况下 async/await 能取代 promise
  • [ ] webpack 体积 + 编译速度性能优化
  • [ ] es5 function 几种继承过程
  • [ ] 如何阻止浏览器原生右键弹出, e.preventDefault()
  • [ ] Http 复杂请求 优化 + Loading
  • [ ] docker 多个实例集群部署
  • [ ] MySQL 关联查询
  • [ ] vuex/redux 实现机制, 属性如何在根节点注入,各个子组件都能获取 - context
  • [ ] ....继续补充

React 开发原则

尽可能使用 PureComponent,增强性能... 尽可能细化组件.

React Router

  • <Link />: 普通链接
  • <NavLink />: 带 toggleClass 的链接
  • <Prompt />: 满足条件的时候提示用户是否离开页面
  • <Redirect />: 重定向
  • <Route />: 路由匹配核心,匹配则显示的组件
  • <Switch />: 只匹配第一个路由
  • exact, 默认匹配的一个路由

看过的书