Touch your hand to teach you Taro+dva+Hooks to quickly develop small programs
Recently, in the research of small programs, we used Jingdong React based small program development framework Taro. Compared with mpvue and uni app, Taro is more elegant and stable. Big factories are iterating, but it is different. In a word, there are fewer pits ~
Pre knowledge
Before reading this tutorial, you need to master the developme ...
Posted by jesse_james on Wed, 29 Sep 2021 19:59:16 -0700
5, React -- List & Key, form
List & key
1, Use of. map()
1. List components of rendering basis
This component takes the numbers array as a parameter and outputs a list of elements.
const numbers = [1,2,3,4,5]
function NumList(props){
const numbers = props.numbers;
const listItems = numbers.map((number)=>(
<li>number:{number}</li>
...
Posted by serbestgezer on Mon, 27 Sep 2021 03:25:03 -0700
axios token authority authentication request mechanism, and the front end realizes senseless refresh
axios token authority authentication request mechanism
Detailed explanation of parameter attributes
Mechanism process
1. Login
The user enters the account and password to log in. After successful login, save the user information, token and other information to the local localstorage.
2. Add request header to global axios
When importing th ...
Posted by deljhp on Fri, 24 Sep 2021 00:49:17 -0700
Summation case of React learning_ react-redux
In actual projects, it is necessary to weigh whether to use Redux directly or react redux. React Redux divides all components into two categories: UI component and container component
UI components
It is only responsible for UI rendering without any business logic No state (i.e. this.state variable is not used) All data is provided by ...
Posted by daleks on Wed, 22 Sep 2021 19:05:10 -0700
React performance optimization best practices
React component performance optimization best practices
The core of React component performance optimization is to reduce the frequency of rendering real DOM nodes and Virtual DOM comparison.
1. Clean the components before unloading
The global events and timers registered for window in the component shall be cleared before the component is u ...
Posted by zander213 on Tue, 21 Sep 2021 23:21:15 -0700
Use and principle of Vuex
1, What is Vuex?
Vuex is a state management mode specially designed for Vuejs applications, similar to Redux in React. It uses centralized storage to manage the status of all components of the application.
Official explanation: Vuex is a state management mode specially developed for Vue.js applications. It uses centralized storage to mana ...
Posted by trg on Tue, 21 Sep 2021 20:59:52 -0700
How to configure Less, px to reem, antd mobile and routing in TypeScript in React
Create project
create-react-app ts3 --template typescript
Configure less
cnpm install less-loader less --save-dev
Find node_ React scripts / config / webpack.config.js under modules The above two lines of code are placed in Click ctrl+f to find the sassModuleRegex and put it on the top of the comment
const lessRegex = /\.less$/;
const ...
Posted by xmatthawkx on Fri, 17 Sep 2021 20:26:32 -0700
Learn the basics of webpack
1, Introduction to webpack
What is webpack
webpack is a front-end resource building tool and a static module packer
In webpack, all file resources in the front end (js/json/css/img/less) are treated as modules. It will perform static analysis according to the dependency of the module and package the corresponding static resources.
...
Posted by ShadowIce on Sun, 05 Sep 2021 16:14:54 -0700
Core concepts of React
Core concept of React (2)
1. Component introduction and props
1.1 component classification
Component, conceptually similar to JavaScript functions. It accepts any input parameter (i.e. "props") and returns the React element used to describe the content of the page presentation( Quoted from: Components & props )
Compo ...
Posted by Zepo. on Wed, 01 Sep 2021 16:13:44 -0700
Use ResizeObserver to monitor the size of a single element
1, API introduction
ResizeObserver
This is an API that can monitor the size and position changes of an element. It is a class. It provides an observer, which will be called on each resize event. Currently, chrome, safari and fireFox(pc) are basically supported.
2, General usage
const resizeOb= n ...
Posted by mark_18 on Tue, 23 Jun 2020 00:43:40 -0700