Blog
Blog copied to clipboard
经常写博客的地方,会时常记录一些学习笔记、技术博客或者踩坑历程。
## 前言 在 **[十分钟学会 react-redux](https://github.com/beichensky/Blog/issues/8)** 一文中详细讲解了 `react-redux` 的使用。 在 **[从零到一实现 Redux](https://github.com/beichensky/Blog/issues/9)** 中,实现了关于 redux 的核心代码。 下面我们按照上一篇的节奏,继续实现一下 `react-redux` 的核心代码。 > 本文已收录在 `Github`: [https://github.com/beichensky/Blog](https://github.com/beichensky/Blog) 中,欢迎 Star! ## 核心 API 包含以下核心 `API` - `Provider`:...
## 前言 上一篇文章 [轻松掌握 Redux 核心用法](https://github.com/beichensky/Blog/issues/7) 详细讲解了 `redux` 的使用。 这篇文章我们按照上一篇的节奏,实现一下 `redux` 的核心代码。 > 本文已收录在 `Github`: [https://github.com/beichensky/Blog](https://github.com/beichensky/Blog) 中,欢迎 Star! ## 核心方法 - `createStore`: 创建 `store` - `combineReducers`: 合并 `reducer` - `applyMiddleware`:...
## 前言 本文主要介绍了 react-redux 的用法,以及在各种场景下不同 API 的使用方式和区别。 本文代码是在上一篇博客的基础上进行的,有疑惑的地方可以先查看上一篇博客:**[轻松掌握 Redux 核心用法](https://github.com/beichensky/Blog/issues/7)** > 本文已收录在 `Github`: https://github.com/beichensky/Blog 中,欢迎 Star! ## 一、准备工作 ### 安装 ```bash npm install react-redux # or yarn add react-redux ```...
本文详细介绍了 React 生命周期的用法以及各个阶段的生命周期进行,并且用实例代码做了详细演示。 **[Demo 地址](https://github.com/beichensky/ReactUtilsDemo/tree/master/react-component-lifecycle)** ## 前言 本文已收录在 `Github`: [https://github.com/beichensky/Blog](https://github.com/beichensky/Blog) 中,欢迎 Star! ## 话不多说,先上图  > 上图是基于 React 16.4 之后的生命周期图解。如感觉不对,请先查看 React 版本 ## React 生命周期详解 ### 各个阶段的生命周期函数 #### constructor 构造函数...
本文已收录在 `Github`: https://github.com/beichensky/Blog 中,欢迎 Star! ## 写在前面 本文代码通过 `create-react-app` 脚手架进行搭建,所有的代码均可直接复制运行。 代码位置:**[react-redux-demo](https://github.com/beichensky/ReactUtilsDemo/blob/master/react-redux-demo)** 本文主要讲解了 Redux 和 React-Redux 的使用,详细的概念以及设计思想请看 **[Redux 中文官网](https://cn.redux.js.org/docs/faq/DesignDecisions.html)** - 使用 [`create-react-app`](https://www.html.cn/create-react-app/docs/getting-started/) 创建 `React` 项目 ```bash # npx npx create-react-app my-app...
本文简要介绍了 React 中 PureComponent 与 Component 的区别以及使用时需要注意的问题,并在后面附上了源码解析,希望对有疑惑的朋友提供一些帮助。 ## 前言 先介绍一下 PureComponent,平时我们创建 React 组件一般是继承于 Component,而 PureComponent 相当于是一个更纯净的 Component,对更新前后的数据进行了一次浅比较。只有在数据真正发生改变时,才会对组件重新进行 render。因此可以大大提高组件的性能。 本文已收录在 `Github`: [https://github.com/beichensky/Blog](https://github.com/beichensky/Blog) 中,欢迎 Star! ----- ## 对比 Component 和 PureComponent ###...
本文对 16.8 版本之后 React 发布的新特性 Hooks 进行了详细讲解,并对一些常用的 Hooks 进行代码演示,希望可以对需要的朋友提供些帮助。 ## 前言 本文已收录在 `Github`: https://github.com/beichensky/Blog 中,欢迎 Star! ## 一、Hooks 简介 `Hooks` 是 `React v16.7.0-alpha` 中加入的新特性。它可以让你在 `class` 以外使用 `state` 和其他 `React` 特性。...
> 本文已收录在 Github: [https://github.com/beichensky/Blog](https://github.com/beichensky/Blog) 中,欢迎 Star,欢迎 Follow! ## 前言 先简单介绍一下 **当前需求** 和 **组件库 Ant Design 中 Table 行合并的 API** - **当前需求**:在使用 Table 组件展示数据时,有一列或者多列,上下多个单元格需要进行合并,合并的规则是:相邻行单元格数据相同时,自动进行合并 - **Table 行合并的 API**:column 的属性 onCell 接受一个函数,函数返回值的属性...