上一页 1 ··· 62 63 64 65 66 67 68 69 70 ··· 88 下一页
摘要: React 会将所有要显示到 DOM 的字符串转义,防止 XSS。所以,如果 JSX 中含有转义后的实体字符,比如 ©(©),则最后 DOM 中不会正确显示,因为 React 自动把 © 中的特殊字符转义了。解决方案:import React, {... 阅读全文
posted @ 2018-10-12 10:57 徐同保 阅读(2339) 评论(0) 推荐(0) 编辑
摘要: import React, { Component } from 'react';import PropTypes from 'prop-types'import { connect } from 'react-redux'import ThemeSwitch fro... 阅读全文
posted @ 2018-10-12 10:24 徐同保 阅读(1062) 评论(0) 推荐(0) 编辑
摘要: App.js:import React, { Component } from 'react';import PropTypes from 'prop-types'import { createStore } from 'redux'import { Provide... 阅读全文
posted @ 2018-10-11 16:49 徐同保 阅读(118) 评论(0) 推荐(0) 编辑
摘要: react-redux.js:import React, { Component } from 'react'import PropTypes from 'prop-types'export const connect = (mapStateToProps, mapD... 阅读全文
posted @ 2018-10-11 15:55 徐同保 阅读(268) 评论(0) 推荐(0) 编辑
摘要: App.js:import React, { Component } from 'react';import PropTypes from 'prop-types'import Header from './Header'function createStore (... 阅读全文
posted @ 2018-10-11 15:21 徐同保 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 1.结合 context 和 storeimport React, { Component } from 'react';import PropTypes from 'prop-types'function createStore (reducer) { let s... 阅读全文
posted @ 2018-10-11 15:02 徐同保 阅读(374) 评论(0) 推荐(0) 编辑
摘要: 1.抽离 store 和监控数据变化 Redux架构模式 2.共享结构的对象提高性能 Redux架构模式 3.reducer Redux架构模式 ... 阅读全文
posted @ 2018-10-11 11:13 徐同保 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 一个组件可以通过 getChildContext 方法返回一个对象,这个对象就是子树的 context,提供 context 的组件必须提供 childContextTypes 作为 context 的声明和验证。如果一个组件设置了context,那么它的子组件都可... 阅读全文
posted @ 2018-10-10 17:16 徐同保 阅读(761) 评论(0) 推荐(0) 编辑
摘要: 组件的私有方法都用 _ 开头,所有事件监听的方法都用 handle 开头。把事件监听方法传给组件的时候,属性名用 on 开头组件的内容编写顺序如下:static 开头的类属性,如 defaultProps、propTypes。 构造函数,constructor。 ge... 阅读全文
posted @ 2018-10-10 15:07 徐同保 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 1.安装:npm install prop-types --save2.使用import React, { Component } from 'react';import PropTypes from 'prop-types'const users = [ 1, ... 阅读全文
posted @ 2018-10-10 14:25 徐同保 阅读(194) 评论(0) 推荐(0) 编辑
上一页 1 ··· 62 63 64 65 66 67 68 69 70 ··· 88 下一页