React form processing
In React, the form is divided into two parts: controlled components and uncontrolled components.
4.7.1 controlled components
We know that form elements in HTML can input data (or delete), that is, they have their own variable state. For example, in a text box, you can enter or delete content in the text box, and the entered content can be cal ...
Posted by nodi on Wed, 17 Nov 2021 20:21:32 -0800
React's Hook allows function components to have the characteristics of class components
1, What problems have been solved?
Hook is a special function starting with use (useState, useEffect, etc.), which can only be used inside the function component. It allows you to use state and other React features without writing class. For example, useState is equivalent to the state object in the class component.
1. Update instructions for ...
Posted by Ryodox on Tue, 16 Nov 2021 17:24:23 -0800
Process of actual online chat room of React all Hook project: add a live music broadcast?
Previously on:
Actual online chat room course of React full Hook project (I): basic functions Actual online chat room course of React full Hook project (II): quotation and topic function
text
What should chat have? Background music, tea and wine, snacks, I can't realize the last two, but we can add a background music function to our online c ...
Posted by dudejma on Tue, 16 Nov 2021 01:14:21 -0800
Teach you to write a React state management library
Since the implementation of React Hooks, Redux is out of place as a state management scheme. Dan Abramov mentioned "You might not need Redux" a long time ago. Developers must write a lot of "pattern code". Cumbersome and repetition are not tolerated by developers. In addition to the fact that the concepts such as actions/red ...
Posted by admin101 on Fri, 12 Nov 2021 19:03:17 -0800
react=> setState advanced from zero
setState has three features:
Code first:
export default class App extends Component {
state = {
n: 1
}
hClick = () => {
this.setState({n: 100})
console.log(this.state.n)// How much is printed here?
console.log(document.getElementById('span').innerHTML) // How much is printed here?
}
render () {
return (
...
Posted by kenhess on Thu, 11 Nov 2021 09:12:19 -0800
Start from zero react = > react component advanced
props verification - basic usage:
In the previous blog, we mentioned the verification of props, as shown in the figure:
Props verification: for child components, props is foreign (it accepts the parameters passed by the parent component), and it is impossible to guarantee the format of data passed in by the component user. With type ...
Posted by alkhatareykha on Wed, 10 Nov 2021 17:17:24 -0800
React from 0 with react item 1
Knowledge points:
webpack with react environmentRealize adaptationConfigure dynamic routing
webpack with react environment
Installation dependency
npm init -ycnpm install react react-dom @types/react @types/react-dom react-router-dom @types/react-router-dom antd redux react-redux @types/react-redux react-thunk redux-logger @types/redux-logg ...
Posted by RonHam on Wed, 10 Nov 2021 06:15:35 -0800
Ideas for designing high performance react components
For a high-performance react component, it is important to reduce redrawing and rearrangement, server rendering, and so on.
In a react application, the logic is organized as a react component, which splits the UI into separate, reusable components. Then the component performance optimization is maliciously considered from the perspective of co ...
Posted by ehhwan on Tue, 09 Nov 2021 08:38:34 -0800
React Base_ 4 (Life cycle. Hook function)
Preface
Lifecycle of components and associated hook functions
text
Lifecycle of components: The life cycle is the entire process from creation of a component to not running unloaded from a page. There are many functions that run throughout the life cycle, which are hook functions. Only class components have a life cycle. Hook function at cre ...
Posted by predhtz on Mon, 08 Nov 2021 14:20:35 -0800
React Basics_ 6 (principle and Optimization)
preface
1. Relevant principles of react 2.React performance optimization
text
Introduction to related principles of React setState method, which updates the data asynchronously, and calls the setState method several times, and finally only re renders the render method once
class App extends React.Component{
state={
num:0
}
...
Posted by broseph on Mon, 08 Nov 2021 07:48:43 -0800