React父组件和子组件解耦方案
本文主要介绍在 React 中的几种将父组件和子组件解耦的方案。
react中减少render臃肿的方法
最近看了mobx的相关知识,对computed属性十分喜欢。
想起在日常的项目开发中,react经常需要在render函数的开始部分进行一些props属性的计算,再将计算值用于渲染。一般会有以下画面:
1234567class User extends Component { render() { const { firstName, secondName } = this.props; const fullName = firstName + secondName; return <div>{fullName}</div> }}
当业务逻辑复杂时可能会造成render函数十分的臃肿。也许我们会进行这样的优化:
123456789class User extends Component { getFullName = () => { const { firstName, secondName } = thi ...
Create-react-app中使用装饰器语法
本文主要介绍了如何在cra项目中拓展使用装饰器语法,从而支持mobx的装饰器。
hexo发布文章流程记录
新建文章
1hexo new post "title"
生成静态网页
1hexo g
本地预览
1hexo s
同步至 github 服务器
1hexo d