Class component, functional component, JSX syntax, data-driven design idea and event binding, TodoList function, etc. in React
What is JSX syntax
In JSX syntax, there are two types of tags:
1. Normal html tags (lowercase initial)
2. Component label (capitalized)
Using React to write TodoList function
src/TodoList.js
import React,{Fragment} from 'react';
function TodoList() {
return (
<Fragment>
<input type="text" />
<ul>
...
Posted by joviyach on Mon, 13 Apr 2020 09:15:16 -0700
React Props simple demo
The main difference between state and props is that props is immutable, and state can be changed according to the interaction with users.
Set the default value for props through the defaultProps property of the component class
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './A ...
Posted by mottwsc on Mon, 13 Apr 2020 07:51:57 -0700
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