Summary of setState learning in React

Whether the setState method in react is asynchronous or synchronous depends on the conditions. 1. Let's review several ways to change state in react component: import React, { Component } from 'react' class Index extends Component { state={ count:1 } test1 = () => { // Through the form of callback function ...

Posted by SimpleManWeb on Wed, 18 Dec 2019 14:22:10 -0800

Immutable JS for React rendering optimization (2)

In the previous section, we implemented a simple performance optimization, but because we need a deep copy and property comparison, the performance is still poor, so we use immutable.js written by Facebook God for further optimization Immutable collection of immutable.js JavaScript Each modification will return a new object ...

Posted by nashirak on Wed, 18 Dec 2019 13:10:59 -0800

Taro realizes chatting, taro imitates wechat chat interface, taro+redux multi terminal instance

Recently, we have been exploring and developing multiple terminals, which has been used before uniapp+vue develops the project of multi terminal imitative buffeting / Momo live studio Today, I want to share the TaroChat project based on the taro+react multi terminal wechat like interface chat room, which also supports compiling to H5, applet an ...

Posted by bobbinsbro on Tue, 17 Dec 2019 05:06:23 -0800

Data flow scheme of transforming old project with dva

Preface Recently, I had some trouble transferring my scaffolding project to TypeScript. Before the project, the system of react + react Redux + Redux thunk + Redux actions + Redux promise was adopted. When a project is converted to TypeScript, react and react Redux are perfect conversions. Redux actions transformation is also initially complete ...

Posted by TonyB on Fri, 13 Dec 2019 04:46:57 -0800

react event binding ES6

Article reference Summary of ES6 in React.js Case description import React from "react" import { NavBar, Button, Icon } from "antd-mobile" class Photegraph extends BaseComponent { // video and mediaStreamTrack are properties of the photographic class video; mediaStreamTrack; // Constructor constructor (props) { ...

Posted by su1d on Thu, 12 Dec 2019 13:06:50 -0800

Record of rare writing method of react

function App1() { return <Greeting firstName="Ben" lastName="Hector" />; } function App2() { const props = {firstName: 'Ben', lastName: 'Hector'}; return <Greeting {...props} />; } <MyComponent message="&lt;3" /> <MyComponent message={'<3'} /> <MyComponent message="hello world" /> ...

Posted by duny on Thu, 12 Dec 2019 08:01:18 -0800

GridManager format data

GridManager When processing data, it is necessary to use the specified data format. In the actual scene, there are some format differences more or less. How to deal with these differences will be explained here 1. Only return field name is inconsistent Data and totals in the primary data can be adjusted by using dataKey and totalsKey. The back- ...

Posted by xray_griff on Thu, 12 Dec 2019 06:16:29 -0800

Write a UML plug-in to automatically generate code to free cv's hands

Introduction Recently, I am writing a middle stage project, which uses the UML framework of react. All kinds of additions, deletions, modifications and searches. It's basically a list page, a new page, a detail page In order to avoid unnecessary simple repetition (mainly to be lazy), I want to implement my own code generator explore First of al ...

Posted by fitzsic on Tue, 10 Dec 2019 10:23:56 -0800

Javascript Design Pattern

Design principles (SOLID) Single responsibility model Principle of lie substitution Open and closed principle Interface isolation principle Principle of Dependence Inversion Design pattern Factory mode Encapsulate the new operation separately When encountering new, consider whether to use factory mode Example You go to buy hamburgers, order a ...

Posted by JoelRocks on Mon, 09 Dec 2019 14:44:23 -0800

axios unified interface management and optimization

I wrote before An article , sharing the methods of interface management in their own projects. The conclusion is: define interface file -- with Axios export -- call interface method. In this way, the unified management of the interface and the semantics and simplifications of the calling interface are realized.   According to the use in the p ...

Posted by adamhhh on Sun, 08 Dec 2019 14:46:07 -0800