随笔分类 - react
打算开始学习前端三大框架之一的react,开始来记录自己点滴的学习,加油
摘要:通过npm run analyze查看打包情况,发现chunks中包含大量的重复打包 通过提取公共chunk来实现减少打包体积以及提高打包速度 从原来的20M经过拆包之后 最终变成了4M 官方文档 https://umijs.org/zh-CN/config#chainwebpack // http
阅读全文
摘要:1. 项目基本准备工作 1.1 创建项目 利用npx create-react-app my_react命令创建项目 项目已经放到github:https://github.com/caozhongjie/simple-react.git 有什么不对的或者建议或者疑惑,欢迎指出! !!!在仓库代码中
阅读全文
摘要:安装:yarn add redux react-redux 1、定义store文件 store.js import { createStore } from 'redux'; import reducer from './reducer'; const configureStore = () =>
阅读全文
摘要:yarn add redux-saga mysaga.js 定义saga文件 import {call, put, takeEvery} from 'redux-saga/effects' // 模拟登陆接口 const UserService = { login(name) { return ne
阅读全文
摘要:调用界面 import React, {Component} from 'react'; // import {BrowserRouter, Link, Route, Switch} from "react-router-dom"; import {BrowserRouter, Link, Rout
阅读全文
摘要:1、series数据之间有空得时候就不会连接,会出现断点 解决方案:在series的子对象中加入connectNulls:true即可解决 2、legend上的图例,默认点击为关闭改图例数据,需求:点击显示该图例 解决方案:https://blog.csdn.net/anoiadream/artic
阅读全文
摘要:class App extends React.Component { handleClick = () => { const { input } = this.inputRef; // 如果是textArea的话,const { textAreaRef } = this.inputRef; input.focus(); input.setSelectionRange...
阅读全文
摘要:将父组件的方法传递给子组件,子组件通过this.props调用传递过来的方法,并带上参数 父组件 子组件 调用传递过来的getChildValue方法,并传入this,传递的参数带在后面,此时父组件中的childValue会得到该值 将子组件的数据组合之后传递
阅读全文
摘要:page 下的index文件 model层的使用 this.props.add() -> dispatch -> addNewNumer() ->数据改变 -> render()重新渲染视图 使用effects中的方法同理 mock数据
阅读全文
摘要:https://www.jianshu.com/p/7a6708cde333 安装:yarn add redux react-redux --save redux分为三个部分组成action reducer store action可以触发reducer中的state 在改变共享状态的文件处使用 c
阅读全文
摘要:https://www.npmjs.com/package/jsonp 原生jsonp的使用 1.yarn add jsonp --save 2.import JsonP from 'jsonp' 3.JsonP('url',{},function(err, data){ console.log(d
阅读全文
摘要:1.暴露出配置文件 yarn eject 2.安装yarn add less less-loader antd babel-plugin-import (less需要在2.7.3版本和3.0之间。yarn add less@2.7.3) 3.在webpack.config文件中配置 http://w
阅读全文
摘要:https://blog.csdn.net/xxygreen_hand/article/details/90672774(全配置Less和antd主题) 在学习一些react项目时,视频教程中的webpack版本较低,在我们使用npm run eject 或者yarn eject来暴露配置文件时,
阅读全文
摘要:1.安装模块 npm install axios --save / npm install fetch-jsonp --save 2.在使用的页面引入 fetch-jsonp
阅读全文
摘要:https://reacttraining.com/react-router/web/example/basic // git 实例地址 1.安装 npm install react-router-dom --save 2.引入 import { BrowserRouter as Router, R
阅读全文
摘要:import React from 'react' class LifeCycle extends React.Component{ constructor(props) { console.log('我是constructor') super(props) this.state = { value: '生命周期组件...
阅读全文
摘要:import React from 'react' class TodeList extends React.Component { constructor(props) { super(props) this.state = { hasDoneList: ['看书', '跑步', '仰卧起坐', '俯卧撑'], // 已经做了的...
阅读全文
摘要:import React, {Component} from 'react'; class Home extends Component { constructor(props) { super(props) this.state = { value: '' } this.input = React...
阅读全文
摘要:import React from 'react' class Home extends React.Component{ constructor(props){ super(props) this.state = { msg: 'Home组件中的数据' } this.getMessage = th...
阅读全文

浙公网安备 33010602011771号