React
jiuweiC
这个作者很懒,什么都没留下…
展开
-
Objects are not valid as a React child (found: object with keys {status, data, operationId, correlat
Objects are not valid as a React child (found: object with keys {status, data, operationId, correlationId}). If you meant to render a collection of children, use an array instead or wrap the object us...原创 2018-07-30 18:16:35 · 5305 阅读 · 0 评论 -
react 生命周期
一、整体流程1、装载——》2、更新——》3、卸载二、具体流程1.装载 constructor() static getDerivedStateFromProps() render() (4)componentDidMount() componentDidMount() 在组件装载(mounting)(插入树)后被立即调用。初始化所需要的 DOM 节点的应该放在这里。...原创 2018-07-10 14:11:03 · 150 阅读 · 0 评论 -
React 组件内方法
一、React 组件内方法自动执行组件内写了隐藏右部的方法, hideRight() { this.setState({ record: {}, }); }点击事件如下 onClick={this.hideRight()}如上写法hideRight每次都会自动执行 正确写法1. onClick={thi...原创 2019-02-13 10:00:03 · 608 阅读 · 0 评论 -
自定义ant.design form组件
问题: 实现ant.design form组件自定义主要是实现value接口,即能通过form.props直接获取组件的value实现方案: this.props.onChange()方法,这个方法是组件经过getFieldDecorator包装后就会有的一个方法。通过该方法可以将自定义组件的值传递给form代码实现import React from 'rea...原创 2019-02-19 14:37:56 · 1417 阅读 · 0 评论 -
React生命周期实践
一、初始化阶段1、设置组件的默认属性static defaultProps = { name: 'sls', age:23};//orCounter.defaltProps={name:'sls'}2、设置组件的初始化状态constructor() { super(); this.state = {number: 0}}3、comp...转载 2019-02-19 16:13:41 · 122 阅读 · 0 评论 -
Elastic Api 的React实现
Es Api 的React实现demo地址:https://github.com/jiuweidao/es-demoElastic查询 官方文档 https://www.elastic.co/guide/en/elasticsearch/reference/6.7/query-dsl.htmles的封装实现import React from 'react';import {p...原创 2019-03-01 10:26:51 · 483 阅读 · 0 评论 -
react 问题集合
react 问题集合1.一处prop更新全局更新原因:不同组件共用了相同的state,2.reducer更新时,对比没有变化组件状态跟新代码componentDidUpdate(preProps, preState) { if (this.props.mapMsg.logAry != preProps.mapMsg.logAry && this.props.map...原创 2019-05-21 11:20:19 · 118 阅读 · 0 评论