Real router V4 & V5 interceptor (hook), static route, route view implementation

premise Before the v3 version of React Router, there was the onEnter hook function, which also supports the static routing configuration; however, after the v4 version, the hook function was removed, which is officially intended to be provided to developers, who can play it freely. In this case, we can only realize it ourselves. At present, th ...

Posted by sandrine2411 on Sat, 04 Apr 2020 13:35:56 -0700

React subcomponents communicate with parent components

The communication between the React subcomponent and the parent component includes the following aspects: 1. The child component gets the parent component property: props or state 2. Method of child component calling parent component 3. The parent component gets the properties of the child component: props or state ...

Posted by mrmufin on Sat, 04 Apr 2020 12:02:30 -0700

Scala Actor concurrent programming WordCount

Scala Actor concurrent programming WordCount Demand: Write a stand-alone WordCount with actor concurrent programming, take multiple files as input, summarize multiple tasks after calculation, and get the final result. General steps: 1. Continuously receive messages through loop +react 2. Using case class sample cla ...

Posted by php_b34st on Sat, 04 Apr 2020 09:28:51 -0700

Step by step allows you to quickly upgrade your React Router v5 router to v6

Thank you for your reference- http://bjbsair.com/2020-04-01/tech-info/18408.html Pictures from the Internet 1 Introduction The version of react route V6 alpha has been released. This week, we will analyze the changes through the article a snake peak at react route V6. React Router v6: https://github.com/ReactTraining/react-router A Sneak Peek ...

Posted by pojr on Sat, 04 Apr 2020 03:50:13 -0700

dva.js usage details: list display

github: https://github.com/axel10/dva_demo-Counter-and-list/tree/master   This time, we use the case of getting user data online and rendering it into a list to demonstrate dva.js. The whole development process should be summarized as follows: Write user list model - > write method to modify model - > write service interface - > write ...

Posted by caminator on Fri, 03 Apr 2020 23:26:46 -0700

React SERIES V (react props)

React SERIES V (react props) 1, Using React Props The main difference between state and props is that props is immutable, and state can be changed according to the interaction with users. This is why some container components need to define state to update and modify data. Sub components can only pass data through props. &l ...

Posted by The Eagle on Thu, 02 Apr 2020 22:10:33 -0700

React tutorial (2) - jsx syntax, conditional rendering, list rendering

1. JSX syntax In react, the syntax of jsx is used to display DOM elements. The react template of a basic jsx syntax is as follows: <div>{this.props.title}</div> The essence of this approach is: embed js expressions in html!! How does the compiler compile jsx syntax? The rule is as follows: when it comes to parsi ...

Posted by disaster77 on Tue, 31 Mar 2020 11:08:21 -0700

40 line program integrates the response of Vue3 into React for state management

This article refers to the original- http://bjbsair.com/2020-03-22/tech-info/2095/ Preface Vue next is the source warehouse of vue3. Vue3 uses lerna to divide the package, while the responsive capability @ vue/reactivity is divided into a separate package. If we want to integrate it into React, is it feasible? Let's have a try. Use example If ...

Posted by double on Tue, 24 Mar 2020 01:02:28 -0700

React Hook + TS shopping cart practice (performance optimization, closure trap, custom hook) - Zhihu

Preface This article is based on a basic shopping cart demand, step by step, to give you a deep understanding of the pit and Optimization in React Hook You can learn from this article: A kind of Practice of writing business components with React Hook + TypeScript A kind of How to use React.memo to optimize performance A kind of ...

Posted by Karamja on Fri, 20 Mar 2020 13:28:36 -0700

React learning: instance of state promotion

The following example scenario is written by myself after I read the official document. Please refer to: Official document: Status Improvement The following scenarios are the same as the temperature conversion scenarios in the official documents: Temperature value conversion scenario Let's start my scene, Example: First ...

Posted by madcat on Thu, 19 Mar 2020 09:43:53 -0700