Prototype and inheritance
brief introduction
Six concepts of object-oriented: object (instance), class, encapsulation, inheritance, polymorphism and aggregation.
js does not have the concept of class. It extends new objects based on objects (constructors and prototype objects).
Encapsulation: put the independent attributes in the constructor and the shared p ...
Added by colake on Thu, 27 Jan 2022 22:59:55 +0200
Four ways of communication between react hook components
preface
Since the official introduction of hook by react, many partners have changed from the old class component to hook component. However, there are still some differences between hook component and class component, so the following summarizes four parameter transmission methods
1, Father to son
The child component receives the dat ...
Added by DaiWelsh on Thu, 27 Jan 2022 22:35:17 +0200
Application of array instance method
Array has many instance methods. Some methods will not change the existing array, but return a new array, and some methods will change the original array. The methods listed in this article are all extracted from real cases of specific projects.
1. forEach
Execute the given function once for each element of the array without changing the origi ...
Added by wscreate on Thu, 27 Jan 2022 22:17:58 +0200
Clear useEffect side effects
In the React component, we will execute the method in useEffect() and return a function to eliminate its side effects. The following is a scenario in our business. This custom Hooks is used to call the interface to update data every 2s.import { useState, useEffect } from 'react';
export function useFetchDataInterval(fetchData) {
const [list, ...
Added by mgm_03 on Thu, 27 Jan 2022 20:36:29 +0200
10 minutes to understand the important features of ES6+(ES2015-ES2019)
ES2015(ES6)
ES2015 is the sixth version of ECMA Script(JS) released in 2015, so it is also called ES6. Since then, ECMA Script has released a large version every year and added some important features, which we call ES6 +.
This paper mainly summarizes the main features of ES2015-ES2019. A learning front-end children's shoe should be some comm ...
Added by shturm681 on Thu, 27 Jan 2022 16:00:50 +0200
TypeScript learning notes
7,Typescript
Official documents
Atwood's law
Jeff Atwood, one of the founders of Stack Overflow, put forward the famous Atwood law in 2007
any application that can be written in JavaScript , will eventually be written in JavaScript.
Any application that can be implemented using JavaScript will eventually be implemented using JavaScri ...
Added by menelaus8888 on Thu, 27 Jan 2022 14:14:45 +0200
node. JS express modular routing and request parameters
preface
In project development, it is not recommended to mix routes with different functions and store them in one file, because with more and more types of routes, it will be very troublesome to manage. In order to facilitate the management of routing, express Router () implements modular routing management.
Method for creating secondary ...
Added by hardyvoje on Thu, 27 Jan 2022 12:16:50 +0200
Vite learning - basic usage configuration
Because vite uses the modular function of the native browser, node cannot be used internally, so there is no require method. This section mainly introduces the common use of vite, including css, ts, env environment variables and import Meta and other functions.CSS processingBasic useIndex. Is added in src directory css@import url('@styles/other ...
Added by iHack on Thu, 27 Jan 2022 09:56:56 +0200
Use js to download the current image
At the front end, we sometimes display the current page as a picture, such as orders and logistics information. At this time, we need not use the screenshot tool to forward, or take photos on the mobile phone. If we use js to download the current html into a picture, how can we do it Here is a tool, html2canvas, which is easy to use
The usage ...
Added by tidalik on Thu, 27 Jan 2022 09:37:25 +0200
Common methods of js array
1. join()
join is to convert an array into a string, and then specify a connecting character for it. The default is comma (,) Writing format: join(""), write a string in parentheses ("quotation marks required"),
var arr = [1,2,3];
console.log(arr.join()); // 1,2,3
console.log(arr.join("-")); // 1-2-3
console.log(arr); ...
Added by Pha on Thu, 27 Jan 2022 09:21:04 +0200