![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
react
文章平均质量分 81
MiemieWan
这个作者很懒,什么都没留下…
展开
-
手写redux源码及其中间件
一、redux的使用1.redux的工作流程:通过createStore创建一个store仓库,用来存储状态; store接收的第一个参数reducer,初始化state并定义state修改规则; 页面中通过dispatch⼀个action来提交对数据的修改; action提交到reducer函数⾥,根据传⼊的action的type,返回新的 state。2.相关代码:创建项目,安装reduxnpx create-react-app write-reduxnpm i --s.原创 2021-06-23 16:27:29 · 219 阅读 · 0 评论 -
redux和react-redux
一、redux工作流程:首先,用户发出 Action。store.dispatch(action);然后,Store 自动调用 Reducer,并且传入两个参数:当前 State 和收到的 Action。 Reducer 会返回新的 State 。let countReducer = (state = 0, action)=>{ switch(action.type) { case 'ADD': return sta原创 2021-04-13 14:56:13 · 460 阅读 · 0 评论 -
React后台实战(react+antd)
一、项目概述1.github地址:https://github.com/141110126/react-admin二、项目1.创建项目:npx create-react-app react-admin2.引入antd(1)安装cnpm i --save antd(2)对antd进行按需引入:安装插件:cnpm i --save react-app-r...原创 2020-04-10 15:09:51 · 409 阅读 · 0 评论 -
React起步
一、安装1.使用 create-react-app 快速构建 React 开发环境,并启动npx create-react-app hello-reactcd hello-reactnpm start2.注意:创建项目反应慢,是因为在寻找相关配置registry时失败了,默认使用了npm安装解决方法如下:将npm的register设置为cnpm:npm config...原创 2020-04-01 14:39:54 · 203 阅读 · 0 评论 -
redux起步(简单易懂)
一、概念1.文档:https://www.redux.org.cn/http://www.ruanyifeng.com/blog/2016/09/redux_tutorial_part_one_basic_usages.html2.redux的作用:处理应用的共享数据。以有条理的方式存储数据,使我们能够在应用的任何组件中快速获取该数据。3.redux的工作流程:(1)用户触发...原创 2020-04-04 19:56:57 · 202 阅读 · 0 评论 -
React笔记(腾讯课堂-最受欢迎的react框架【爱前端】)(react基础)
1.Hello Worldindex.html<!DOCTYPE html><html><head> <title></title></head><body> <div id="app_wrap"></div> <原创 2018-02-28 21:03:17 · 1348 阅读 · 1 评论 -
react基础--官网数字时钟
Lifecycle.js//时钟:生命周期钩子:componentDidMount():组件第一次加载到DOM中的时候执行,componentWillUnmount():DOM被移除的时候执行import React from "react";import "../css/style1.css";class Lifecycle extends React.Component{ co...原创 2018-03-01 15:30:26 · 2219 阅读 · 0 评论 -
react-form表单
import React from "react";// import "../css/style1.css";class Form extends React.Component{ constructor() { super(); this.state = { text: '旺旺', select: "...原创 2018-03-05 16:28:56 · 1778 阅读 · 0 评论