React Hook + TS shopping cart practice (performance optimization, closure trap, custom hook) - Zhihu
Preface
This article is based on a basic shopping cart demand, step by step, to give you a deep understanding of the pit and Optimization in React Hook
You can learn from this article:
A kind of Practice of writing business components with React Hook + TypeScript
A kind of How to use React.memo to optimize performance
A kind of ...
Posted by Karamja on Fri, 20 Mar 2020 13:28:36 -0700
React learning: instance of state promotion
The following example scenario is written by myself after I read the official document.
Please refer to: Official document: Status Improvement
The following scenarios are the same as the temperature conversion scenarios in the official documents: Temperature value conversion scenario
Let's start my scene,
Example:
First ...
Posted by madcat on Thu, 19 Mar 2020 09:43:53 -0700
Enumeration process (analysis of CreateToolhelp32Snapshot function)
I've written some code of enumeration process before. I'm reviewing the code I learned before these two days. I see the CreateToolhelp32Snapshot function. By the way, let's see its specific implementation.
The process of enumerating process information seems easy, just some Windows API functions:
Creat ...
Posted by cmw on Fri, 13 Mar 2020 00:09:04 -0700
How to deal with the error white screen in Ant Design Pro production environment
background
When using Ant Design Pro for development, if it is a component rendering error, the whole page will be directly white screen in the production environment, resulting in a very poor user experience. Generally speaking, when there is a page error, it's OK to prompt the page error. The menu bar on the left should be able to be used nor ...
Posted by Soccerplayer1316 on Sat, 07 Mar 2020 22:59:25 -0800
JavaScript DOM of front-end web
JS HTML DOM
When the web page is loaded, the browser creates the document object model of the page.
With the HTML DOM, JavaScript can access and change all elements of an HTML document.
DOM document operation
Find HTML elements
Method
describe
Example
document.getElementById(id)
Find elements ...
Posted by onepixel on Sat, 07 Mar 2020 00:22:46 -0800
Usage and summary of Rudex
Usage and summary of Rudex
What is Redux
Redux is a popular JavaScript framework that provides a predictable state container (data state management framework) for applications. Redux is based on a simplified version of the Flux framework, a framework developed by Facebook. In the standard MVC framew ...
Posted by Druid on Thu, 05 Mar 2020 20:25:58 -0800
TypeScript basic operation, configuration file tsconfig.json details, vscode and HBuilderX basic configuration
Node basic command
npm installation dependency
[npm install xxx] using npm to install xxx depends on the directory where the current command line is located
[npm install xxx -g] use npm to install global dependency xxx
[npm install xxx – save] install and write to "dependencies" of pac ...
Posted by techevan on Tue, 25 Feb 2020 01:21:36 -0800
How to solve the basic configuration and common pit in React project?
Basic configuration of React project and solution of common pit
1, Create React project
# Global scaffold installation
npm install create-react-app -g --save
# Create React project
create-react-app my-app
2, Implement the loading of Less file
1. Expose profile
# Expose the project's profile
npm run eject
Directory structure after profile e ...
Posted by lady_bug on Mon, 24 Feb 2020 21:24:53 -0800
Resolve page refresh redux data loss issue.
concept
For the current common "one-page application", the advantage is that the front-end can handle more complex data models in a more comfortable way, while transforming based on the data model for better interaction.
Behind good interaction is a model that corresponds to the state of a page component, which is arbitrarily called ...
Posted by joad on Mon, 24 Feb 2020 19:03:00 -0800
The principle of react router DOM
Implement rendering different components according to different paths
There are two ways to achieve this:
HashRouter: it uses monitoring hash change (there is an event hashchange) to realize routing switching. It is a routing container, rendering sub components, and passing (Context context transfe ...
Posted by subrata on Sat, 22 Feb 2020 20:17:50 -0800