What is a constructor
What is a constructor
vue
react
You can get a new object through new. It's the constructor
The introduction of this
<script>
// In the function, whoever this represents calls this function points to
function add(){
var a=10;
var b=20;
console.log('this On behalf of:',this);//this here ...
Posted by ghurty on Wed, 27 Nov 2019 13:11:09 -0800
[dry goods] introduce four practical skills of developing React application
background
Hooks has been very popular since it was launched. It has changed the way we write React code and helped us write more concise code.
Today's article is not about Hooks. Besides Hooks, there are many practical skills that can help us write concise and clear code.
Today, I've sorted out a few skills, some of which are also my practice ...
Posted by steveh62 on Tue, 26 Nov 2019 01:55:37 -0800
Read "unstated and unstated-next source" in detail
1 Introduction
unstated Class Component-based data flow management database, unstated-next It is an upgraded version of Function Component with special optimization for Hooks support.
Compared with redux-like libraries, this library is designed to be unique, and the source lines of both libraries are exceptionally small. Untated-next has less t ...
Posted by sdat1333 on Sun, 24 Nov 2019 18:29:50 -0800
JavaScript Design pattern part 1: Singleton pattern
What is singleton mode
Singleton Pattern ensures that a class has only one instance and provides a global access point to access it
Singleton pattern is a simple and easy to understand design pattern, but its usage scenarios are very wide, including the famous Vuex also uses singleton pattern.
This article introduces two implementation methods ...
Posted by ztealmax on Sun, 24 Nov 2019 07:24:59 -0800
Use React to write a dialog box or modal box
It's been a long time since I planned to use React to write dialog boxes. Now it's time to fulfill my promise. In fact, it's quite simple to write.
The core is to use the interface of React.createPortal(element, domContainer). This interface embeds the element rendered DOM node into the domcontainer (usually document.body) and ensures that it ...
Posted by kh411dz on Sat, 23 Nov 2019 08:01:53 -0800
Chat rooms with Swoole+React
Front-end separated projects, chat rooms implemented by Swoole+React, the framework structure of the entire project can be referenced, front-end react+react-redux+react-router+react-ant, etc. Background uses easySwoole to implement the middleware (data encapsulation, token verification, signature verification) by itself, and carefully look at t ...
Posted by magmazing on Sat, 23 Nov 2019 01:45:57 -0800
The problem that the value of select drop-down box in antd is object selection
When using the select drop-down box in antd, there is a small problem. In the background management system, the use of the drop-down box will not simply use the value value value in select, but will use the keyword corresponding to the id or value in Chinese, and the value value value in option may be repeated
1. effect picture
2.select relate ...
Posted by qing on Fri, 22 Nov 2019 02:33:20 -0800
Under the shader of OpenGL learning
Previous section On the shaders of OpenGL learning In this section, we will create a shader class and use the C + + file stream to read the contents of the shader.
I. create shader class
We can directly right-click the solution and select new class. This will automatically generate a. h and a. cpp file. We can also create a. h a ...
Posted by vinnier on Tue, 12 Nov 2019 07:23:00 -0800
A piece of magic code to monitor DOM
By Eddie AichCrazy technology house
Original text: https://dev.to/eddieaich/spy-...
No reprint without permission
With this module, you can quickly view the properties of DOM elements by hovering over the browser. Basically it's an instant checker.
Hovering over a DOM element displays its properties!
Try it on your own
Copy the entire block o ...
Posted by ask9 on Mon, 11 Nov 2019 01:18:00 -0800
Using typescript to write react-redux and redux-thunk, and the implementation of thunk and other middleware
General steps for using react-redux
Provider, as the provider of the top-level global state, needs to pass a parameter, the global state store
import { Provider } from 'react-redux';
<Provider store={ store }></Provider>
Stores are created by the createStore function and need to pass the reducer pure function as a parameter
impor ...
Posted by amberb617 on Sat, 09 Nov 2019 22:09:38 -0800