摘要: React基础 0.JavaScript基础知识 1.React语法规则 2.React组件及其三大属性 3.React事件处理、收集表单数据、高阶函数 4.React生命周期 5.key的使用 React高级 1.Tolist案例(父子传参实现增删改) 2.github搜索案例(axios、pub 阅读全文
posted @ 2021-09-03 17:21 tomjoy 阅读(130) 评论(0) 推荐(0) 编辑
摘要: postgresql集群搭建 基于pgpool中间件实现postgresql一主多从集群部署,这里用两台服务器作一主一从示例 虚拟机名 IP 主从划分 THApps 192.168.1.31 主节点 YY-Test-01 192.168.1.36 从节点 vip 192.168.1.100 虚拟ip 阅读全文
posted @ 2021-09-24 14:00 tomjoy 阅读(3346) 评论(0) 推荐(1) 编辑
摘要: 2.react-redux的使用 npm install --save react-redux 1.基本使用 containers/Count.jsx -- 容器组件 -- 用于传递 redux保存的状态和操作状态的方法 到 UI组件中 // 引入Count的UI组件 import CounUI f 阅读全文
posted @ 2021-09-03 16:55 tomjoy 阅读(488) 评论(0) 推荐(0) 编辑
摘要: 1.redux的使用 核心概念 action 动作的对象 包含2个属性 type:标识属性, 值为字符串, 唯一, 必要属性 data:数据属性, 值类型任意, 可选属性 例子:{ type: 'ADD_STUDENT',data:{name: 'tom',age:18} } reducer 用于初 阅读全文
posted @ 2021-09-03 16:54 tomjoy 阅读(99) 评论(2) 推荐(0) 编辑
摘要: 4. render props和Error boundary(错误边界) 4.1 render props 如何向组件内部动态传入带内容的结构(标签)? Vue中: 使用slot技术, 也就是通过组件标签体传入结构 <A><B/></A> React中: 使用children props: 通过组件 阅读全文
posted @ 2021-09-03 16:51 tomjoy 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 3. context和optimize优化 3.1 context context用于祖孙组件之间的传参 import React, {Component} from 'react'; import './index.css' // 创建一个context组件,供传递数据使用 const MyCon 阅读全文
posted @ 2021-09-03 16:49 tomjoy 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 2.hook和Fragment 2.1 hook 1. React Hook/Hooks是什么? (1). Hook是React 16.8.0版本增加的新特性/新语法 (2). 可以让你在函数组件中使用 state 以及其他的 React 特性 2. 三个常用的Hook (1). State Hoo 阅读全文
posted @ 2021-09-03 16:48 tomjoy 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 1. setState和lazyLoad懒加载 1.1 setState setState更新状态的2种写法 (1). setState(stateChange, [callback]) 对象式的setState 1.stateChange为状态改变对象(该对象可以体现出状态的更改) 2.callb 阅读全文
posted @ 2021-09-03 16:47 tomjoy 阅读(62) 评论(0) 推荐(0) 编辑
摘要: 5.编程式路由导航 1.push和replace模式 {/* 路由模式改成replace替换 , 默认为push堆栈 */} <Link replace to={{pathname: '/home/message/detail', state:{id:msgObj.id, title: msgObj 阅读全文
posted @ 2021-09-03 16:43 tomjoy 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 4.React路由传参 class Message extends Component { state = { messageArr: [ {id: '01', title: '消息1'}, {id: '02', title: '消息2'}, {id: '03', title: '消息3'}, ] 阅读全文
posted @ 2021-09-03 16:41 tomjoy 阅读(212) 评论(0) 推荐(0) 编辑