import {withRouter} from 'react-router-dom'; 并切在导出时候用这个方法包裹住 export default connect(function (state, props){ return state; }, { addItem(item){ return ...
分类:
其他好文 时间:
2020-07-06 20:27:39
阅读次数:
88
Create React Doc 是一个使用 React 的 markdown 文档站点生成工具。就像 create-react-app 一样,开发者可以使用 Create React Doc 来开发、部署 markdown 站点或者博客而不用关心站点环境配置信息。 特性 零配置书写 markdow ...
分类:
其他好文 时间:
2020-07-06 20:15:32
阅读次数:
73
实现 React Hooks UI 开发有两个问题: 展示复用 逻辑复用 展示复用目前基本使用组件化来解决,逻辑复用一直以来都没有特别好的解决方案。React 从一开始的 mixin ,到 高阶组件 以及 Render Props ,都是在试图解决这个问题,但是都引入了一些别的问题。 Mixins ...
分类:
其他好文 时间:
2020-07-06 20:01:21
阅读次数:
64
react 嵌入 iframe 主要是为了隔离富文本,避免跟宿主环境的样式、变量等造成污染。 情况1:后端返回一个完整的网页,前端直接 `<iframe src="$url"></iframe>` 就可以了。 情况2:后端返回内容不可控 (比如以下例子)。 用法: index.tsx: export ...
分类:
其他好文 时间:
2020-07-06 16:07:23
阅读次数:
187
一面 项目: 描述项目某个功能的实现 react的特点 为什么要使用redux+immutable,redux和全局变量的区别 diff算法 react-redux的工作原理和相关源码 还有一些项目的细节 然后是基础知识: 实现一个百度搜索框,包括垂直左右居中,自适应的特性 BFC的相关特性和应用 ...
分类:
其他好文 时间:
2020-07-06 12:41:06
阅读次数:
81
前言 最典型的一个react项目就是react-router+redux(可能再加上redux-thunk或saga),在hooks出来之后,redux也同步跟进加了很多hooks,但已经可以完全抛弃redux,仅仅使用useReducer等hooks来管理数据流了(大型、复杂项目的话,目前还是推荐 ...
分类:
其他好文 时间:
2020-07-06 12:31:01
阅读次数:
156
import { DndProvider } from 'react-dnd'; import { HTML5Backend } from 'react-dnd-html5-backend'; <DndProvider backend={HTML5Backend}> <Table columns={ ...
分类:
编程语言 时间:
2020-07-06 11:21:44
阅读次数:
108
将代码放在index.js 中 AppRegistry.registerComponent('App', () => App)之前 //关闭其中某些yellow警告 console.ignoredYellowBox = ['Warning: BackAndroid is deprecated. Pl ...
分类:
其他好文 时间:
2020-07-05 19:30:50
阅读次数:
85
ideaj环境配置 add dependency: opencv341.jar System.loadLibrary(Core.NATIVE_LIBRARY_NAME); run/debug configurations: VM options: -Djava.library.path="openc ...
分类:
编程语言 时间:
2020-07-05 19:21:56
阅读次数:
72
目录 序言 React 的核心思想 传统 diff 算法 React diff 两个假设 三个策略 diff 具体优化 tree diff component diff element diff 小结 参考 1.序言 此篇文章所讨论的是 React 16 以前的 Diff 算法。而 React 16 ...
分类:
编程语言 时间:
2020-07-05 19:18:01
阅读次数:
102