Real router 4.0 implements login interception

The core code (as follows), in fact, it is very simple to understand the core idea. At the beginning, it was hoodwinked by a large number of official examples, ha ha. const PrivateRoute = ({component:Component,...rest}) => { return ( <Route {...rest} render={props => win ...

Added by kerching on Mon, 13 Jan 2020 16:13:31 +0200

Source code interpretation of React useEffect

Preface The interpretation of the source code is helpful to understand what Hooks has done. If you think useEffect is "magic", this article may help you. This blog is limited in length. It only looks at useEffect and tries to be simple and clear. It will take you to the depth of React Hooks Find the source code of Hook (you can jump d ...

Added by jl5501 on Tue, 07 Jan 2020 15:49:05 +0200

Use async validator to verify forms in React

There is no doubt that form validation in react is tedious, especially for dynamically added or deleted forms, its validation logic is more complex. At present, the UI framework uses material ui, but its form processing is not ideal. Then, another UI framework ant design is studied. Its processing of forms greatly facilitates t ...

Added by aiikcmo on Tue, 07 Jan 2020 01:15:11 +0200

React native's nine palace list

First on the renderings: It's a list like this. UICollectionView can write this type of list directly in iOS, but it can be done directly with FlatList in react native. That is to say, this type of list is no different from ordinary list, just a little different in layout. Let's do it! 1. Render a list render() { ...

Added by rpupkin77 on Wed, 01 Jan 2020 22:11:56 +0200

Reach advanced routing and parameters

  1. Installation depends on the latest version by default npm i react-router react-router-dom --save-dev 2. Import main component object import {BrowserRouter as Router,Route,Link,Redirect} from 'react-router-dom'; 3. The writing structure is inside the component and does not need to be written in the render. The Router ...

Added by philwong on Wed, 01 Jan 2020 12:08:12 +0200

Real + DVA implementation component drag

React+dva implements component drag through Resizable 1. Install dependency package through npm install – save react resizable command 2. This example uses es6 syntax to define the initial value in state. defaultUpHeight saves the current height of the top half of the component when the drag stops defa ...

Added by campsoup1988 on Tue, 31 Dec 2019 12:24:30 +0200

Load dynamic component group

The React project needs to load different components according to the back-end return. Asynchronous component loading AsyncComponent.js import React, { Component } from "react"; export default function asyncComponent(importComponent) { class AsyncComponent extends Component { constructor(props) { super(props); ...

Added by iffy on Sat, 28 Dec 2019 18:59:48 +0200

C# LINQ Learning Notes 5: LINQ to XML

Extract this note from: https://www.cnblogs.com/yaozhenfa/p/CSharp_Linq_For_Xml.html And record the learning process for future reference. 1. Generating xml 1.1 Create simple xml /// <summary> /// CreateXml class /// </summary> public class CreateXml { /// <summary> /// Return xml File Path ...

Added by andrewgk on Sat, 28 Dec 2019 12:06:02 +0200

React source code analysis - first rendering (custom component) II

Preface In the previous article, we explained that after the reactcomponentcomponent [ins] is initialized, the render method of App[ins] is called to generate the ReactElement tree, and then the corresponding ReactDOMComponent[6] is returned. Let's see how the ReactDOMComponent[6] is converted into a DOM tree. performInitialMount: function (ren ...

Added by westonlea7 on Wed, 11 Dec 2019 19:59:29 +0200

react function this correlation

In the process of using react, the execution result is not as expected because of this problem of function. Now, to sort out the following problems, first look at the code: import React from "react"; class MsgList extends React.PureComponent { render() { return ( <ul> {this.props.list.map((item, index) => (<li k ...

Added by billman on Sun, 08 Dec 2019 09:39:13 +0200