![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
react
文章平均质量分 98
|刘钊|
一切皆浮云
展开
-
React之state、hooks性能分析
一、state1、为什么使用setState 开发中我们并不能直接通过修改state的值来让界面发生更新: 因为我们修改了state之后,希望React根据最新的State来重新渲染界面,但是这种方式的修改React并不知道数据发生了变 化; import React, { Component } from 'react'export default class App extends Component { constructor(props){ super(props.原创 2020-09-28 23:05:38 · 833 阅读 · 0 评论 -
Redux使用和剖析
一、JavaScript纯函数函数式编程中有一个概念叫纯函数,JavaScript符合函数式编程的范式,所以也有纯函数的概念; 在React中,纯函数的概念非常重要,在接下来我们学习的Redux中也非常重要,所以先了解一下纯函数。1、纯函数的维基百科定义: 在程序设计中,若一个函数符合一下条件,那么这个函数被称为纯函数: 1)此函数在相同的输入值时,需产生相同的输出。函数的输出和输入值以外的其他隐藏信息或状态无关,也和由I/O设备产生的 外部输出无关。 2)该函数不能有语义上.原创 2020-09-09 22:10:22 · 391 阅读 · 0 评论 -
dva+umi+react+antd-mobile引入JSSDK
安装微信JSSDK安装:npm install weixin-js-sdk使用:var wx = require('weixin-js-sdk');原创 2020-08-06 10:06:49 · 956 阅读 · 0 评论 -
react之运行webpack报错:configuration.module has an unknown property 'loaders'
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.module has an unknown property 'loaders'. These properties...原创 2019-07-27 17:02:06 · 521 阅读 · 1 评论 -
react之运行webpack报错:ERROR in Entry module not found: Error: Can't resolve 'babel-loader'
那就安装一个,终端输入:sudo npm install babel-loader --save原创 2019-07-27 17:19:43 · 1475 阅读 · 0 评论 -
react之运行webpack报错:Error: Cannot find module '@babel/core'
那就安装一个,终端输入:sudo npm install @babel/core --save原创 2019-07-27 17:22:05 · 327 阅读 · 0 评论 -
react之运行webpack报错:Error: Plugin/Preset files are not allowed to export objects, only functions
Error: Plugin/Preset files are not allowed to export objects, only functions这里错误是因为 babel 的版本冲突。 因为 babel 依赖包不兼容。 可以查看你的 package.json 的依赖列表 由于之前安装@babel/core和babel-loader时没有指...原创 2019-07-27 17:55:08 · 1963 阅读 · 0 评论 -
react之运行webpack报错:ERROR in Entry module not found: SyntaxError:
ERROR in Entry module not found: SyntaxError:这是因为我在webpack.config.js和package.json文件中添加了注视,导致报错,json中是不能添加注视的注视删掉就OK了...原创 2019-07-27 18:56:49 · 488 阅读 · 0 评论 -
React项目创建以及webpack配置与热更新
1、cd到文件夹:我以当前日期为文件夹名2、初始化,终端输入:npm init回车键:输入package name,括号内是提示,你可以按照提示输入,我这就按提示输入了,回车version:可以不输入,就直接回车了description:可以不输入entry point:入口文件一般都命名为index.jstest command: 可以不输入git r...原创 2019-07-27 19:41:43 · 4177 阅读 · 0 评论 -
react之安装webpack报错gyp ERR! stack Error: EACCES: permission denied, mkdir
在终端命令中加入--unsafe-perm 就ok了:sudo npm install webpack -g i --unsafe-perm分析:看到Error: EACCES: permission denied, mkdir一般都是权限不够,但是我这前面都加sudo了,看看我的终端命令:sudo npm install webpack -g为啥还是不行呢?n...原创 2019-07-27 16:19:17 · 753 阅读 · 0 评论 -
React之Could not create a project called "ReactDemo1" because of npm naming restrictions: * name c
Could not create a project called "ReactDemo1" because of npm naming restrictions: * name can no longer contain capital letters这是因为该文件夹下没有该名字的文件夹,在该文件夹下手动创建一个ReactDemo1的文件夹后,再执行npx create-r...原创 2019-07-24 18:30:54 · 1613 阅读 · 0 评论 -
react之安装webpack:error An unexpected error occurred: "EACCES: permission denied
error An unexpected error occurred: "EACCES: permission denied, mkdir '/Users/liuzhao/Documents/刘召/RNDemo/2019-7-24/node_modules/@babel/plugin-syntax-dynamic-import/node_modules/debug'".解决办法:终端运行...原创 2019-07-25 10:26:25 · 4049 阅读 · 0 评论 -
react之安装webpack报错
node-pre-gyp WARN Using needle for node-pre-gyp https download node-pre-gyp WARN Pre-built binaries not installable for fsevents@1.2.9 and node@12.4.0 (node-v72 ABI, unknown) (falling back to source...原创 2019-07-25 10:31:26 · 573 阅读 · 0 评论 -
react之安装webpack报错:One CLI for webpack must be installed. These are recommended choices, delivered as
One CLI for webpack must be installed. These are recommended choices, delivered as separate packages: - webpack-cli (https://github.com/webpack/webpack-cli) The original webpack full-featured CLI...原创 2019-07-25 10:35:50 · 255 阅读 · 0 评论 -
react之运行webpack报错ERROR in ./src/index.js 9:0
ERROR in ./src/index.js 9:0Module parse failed: Unexpected token (9:0)You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See http...原创 2019-07-25 10:42:11 · 1565 阅读 · 0 评论 -
react之webpack报错:- configuration.module has an unknown property 'loaders'. These properties are valid
module.exports = { entry: './src/app.js', output: { path: path.resolve(__dirname,'./bin'), filename: 'app.bundle.js' }, module: { loa...原创 2019-07-25 11:36:36 · 451 阅读 · 1 评论 -
react之webpack报错Until loaders are updated one can use the LoaderOptionsPlugin to pass these options t
For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration. Loaders should be updated to allow passing options via loader options in module.rules. Until lo...原创 2019-07-25 11:40:08 · 4998 阅读 · 0 评论 -
react-nativ之Mac node已安装 但是报-bash: npm: command not found
到官网重新下载个node安装下就行了:下面是官网下载地址https://nodejs.org/en/原创 2019-07-27 12:45:57 · 2179 阅读 · 0 评论 -
reac之Error: Cannot find module 'webpack-cli'
Error: Cannot find module 'webpack-cli'解决办法:全局安装,终端输入:npm install webpack-cli -g如果有权限限制加上sudo:sudo npm install webpack-cli -g原创 2019-07-27 12:49:46 · 382 阅读 · 0 评论 -
React之创建项目
环境配置略过,进入官网上面有详细讲解1、打开终端2、cd到自己的文件夹:我这就零时创建一个2019-7-23的文件夹3、初始化josn:终端输入:npm init然后根据提示输入就行(括号中的是提示),这样一个package.json就ok了4、然后开始安装reactdom以及babel-preset-react支持包,在终端输入:sudo npm ...原创 2019-07-23 22:39:59 · 148 阅读 · 0 评论