react source code analysis 10.commit phase
react source code analysis 10.commit phaseVideo Explanation (efficient learning): Enter learningPrevious articles:1. Introduction and interview questions2. Design concept of react3.react source code architecture4. Source directory structure and debugging5. JSX & Core api6.legacy and concurrent mode entry functions7.Fiber architecture8.rende ...
Added by Michael on Tue, 07 Dec 2021 03:08:40 +0200
I open source a lightweight ruler plug-in for the web!
prefaceFront end colleagues who have worked as web side editors will more or less contact ruler plug-ins, similar to plug-ins in ps or PPT software.Older web plug-ins, such as jqury, produce a lot of dom, so they write a ruler drawn with pure TS and canvas, which does not rely on any third-party library. The usage of the document is as follows. ...
Added by gio2k on Sun, 05 Dec 2021 16:30:55 +0200
Summary of Ref related knowledge points in React
I Refs & DOM
1.1 usage scenarios
Manage focus, text selection, or media playback.Trigger forced animation.Integrate third-party DOM libraries.
1.2 creating refs
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.myRef = React.createRef();
}
render() {
return <div ref={this.myRef ...
Added by MrCreeky on Fri, 03 Dec 2021 10:23:04 +0200
The implementation of Error Boundaries is quite ingenious
Hello, I'm Carson.This article will explain the complete implementation logic of Error Boundaries in React.A picture summarizes:Here is a brief explanation of React workflow, which is useful later. There are three steps:Trigger updaterender phase: calculate the side effects caused by updatecommit phase: perform side effects in the host environm ...
Added by Sayian on Fri, 03 Dec 2021 08:37:08 +0200
Installation and use of React!
1, React library descriptionThe react library consists of two parts: 1. React contains all basic functions; 2. ReactDOM only contains the function of operating DOM.1. Load React Library# 1. Load with < script >
Development version:<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
Release:& ...
Added by nova912 on Wed, 01 Dec 2021 21:05:57 +0200
react source code analysis 7.Fiber architecture
react source code analysis 7.Fiber architectureVideo Explanation (efficient learning): Click to learnPrevious articles:1. Introduction and interview questions2. Design concept of react3.react source code architecture4. Source directory structure and debugging5. JSX & Core api6.legacy and concurrent mode entry functions7.Fiber architecture8. ...
Added by pennythetuff on Wed, 01 Dec 2021 04:02:07 +0200
Installation and use of React!
1, React library descriptionThe react library consists of two parts: 1. React contains all basic functions; 2. ReactDOM only contains the function of operating DOM.1. Load React Library# 1. Load with < script >
Development version:<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
Release:& ...
Added by BizBoy on Wed, 01 Dec 2021 01:06:22 +0200
React function component
How to create a function component
Arrow function form
const Hello = (props) => { return <div>{props.message}</div> }
// Can be abbreviated as
const Hello = props => <div>{props.message}</div>
function form
function Hello(props) {
return <div>{props.message}</div>
}
Function components have ...
Added by mcatalf0221 on Fri, 26 Nov 2021 16:08:09 +0200
Talk about several ways to create React Component
createClass
We can use this method to define components without using ES6 syntax
var React = require('react');
var Greeting = React.createClass({
propTypes: {
name: React.PropTypes.string // Attribute verification
},
getDefaultProps: function() {
return {
name: 'Mary' // Default attribute value
}
},
getInitial ...
Added by jokeruk on Fri, 26 Nov 2021 00:55:07 +0200
06 react hooks source code analysis
Why do I need a hook
React document It also explains what problems Hooks proposed to solve:
Reusing state logic between components is difficult.
In the past, in order to separate the logic of a component from reuse and not mix the rendering code into one class, React recommended using high-order components to separate the state logic and tra ...
Added by windwaker on Tue, 23 Nov 2021 03:04:16 +0200