10 2022 档案
摘要:- react-router官网:https://reactrouter.com/ 2021年11月 react router 6 成为默认版本,npm安装时自动安装6版本 每次react router发布都会有3个版本 react-router : 路由的核心库,提供了很多组件钩子 react-r
阅读全文
摘要:- 一、setState的两种用法: setState是异步的调用,当我们代用过setState后,紧接着打印state的值,发现是更改之前的值。 对象式和函数式 import React, { Component } from 'react' export default class Demo e
阅读全文
摘要:- react-redux: facebook团队发现程序员都喜欢用redux在react项目中管理自己的状态,于是就开发了react-redux,目的是让程序员更方便的在react中使用redux。 ui组件一般放在components文件夹下,容器组件放在container文件夹下 ui组件的容
阅读全文
摘要:- redux不是facebook团队开发的,不是只有react才可以用,angla、vue也可以用,不过vue中有专业的状态管理插件,vuex。vue3也出了一个pina。vue中并不用redux。 使用redux的原则是。能不用就不用,除非,不用比用更费劲。 react components :
阅读全文
摘要:- antd官网:https://ant.design/components/ 安装: npm install antd 简单使用: import React from 'react' import './App.css' import { Button, DatePicker } from 'an
阅读全文
摘要:- react路由其实是借助BOM中的History对象实现的,专门有一个history.js的库,可以让操作history对象简单起来。 用history.js可以通过两种方式创建路由对象: 1、History.createBrowserHistory() // 直接使用h5推出的history身
阅读全文
摘要:- fetch文档:https://github.github.io/fetch/ axios和jquery都是基于原生的XMLHttpRequest对象封装的, 除了这个原生对象以外,还有fetch函数也可以请求网络数据 search = async () => { // 获取用户输入 const
阅读全文