随笔分类 -  Redux

摘要:Config store app/store.ts import { configureStore } from "@reduxjs/toolkit"; export const store = configureStore({ reducer: {} }); main.tsx import Rea 阅读全文
posted @ 2022-04-23 17:59 Zhentiw 阅读(297) 评论(0) 推荐(0) 编辑
摘要:This lesson demonstrates that you can get a small performance gain by removing AJAX calls that feed into redux from the react/hooks lifecycle. In this 阅读全文
posted @ 2022-04-11 14:24 Zhentiw 阅读(36) 评论(0) 推荐(0) 编辑
摘要:Highlights: Solve the complexities of write Redux (actions, reducers, selector...middleware...) Solve the immutable pattern with nested spread operato 阅读全文
posted @ 2021-01-02 21:06 Zhentiw 阅读(351) 评论(0) 推荐(0) 编辑
摘要:import { SET_STATUS, FETCH_FULFILLED, FETCH_FAILED, RESET, } from '../actions/beerActions' import lensProp from 'ramda/es/lensProp' import set from 'r 阅读全文
posted @ 2020-04-30 02:00 Zhentiw 阅读(142) 评论(0) 推荐(0) 编辑
摘要:Higher Order Reducers are simple reducer factories, that take a reducer as an argument and return a new reducer. In that new reducer, you can customiz 阅读全文
posted @ 2017-09-15 03:30 Zhentiw 阅读(246) 评论(0) 推荐(0) 编辑
摘要:Redux is one of the most popular state-management libraries and although not specific to React, it is widely used with it. This is why the author of P 阅读全文
posted @ 2017-06-21 23:48 Zhentiw 阅读(614) 评论(0) 推荐(0) 编辑
摘要:Root Smart component can be overloaded, divide 'smart' component wisely & using Provider. Problem: Something the root component can be overloaded, mea 阅读全文
posted @ 2017-02-22 20:12 Zhentiw 阅读(347) 评论(0) 推荐(0) 编辑
摘要:In redux, the action type is just a normal string type, it is easy to get naming conflicts in large application. Can use namespace-constants lib to so 阅读全文
posted @ 2017-02-13 16:04 Zhentiw 阅读(350) 评论(0) 推荐(0) 编辑
摘要:Webpack will hot reload the component, but the reducer we need hard refresh. To sovle the problem, go to the store.js: We just need to config the 'red 阅读全文
posted @ 2016-08-30 16:11 Zhentiw 阅读(214) 评论(0) 推荐(0) 编辑
摘要:If you have props and actions, you want one component to access those props and actions, one solution is pass those from parent to this component. But 阅读全文
posted @ 2016-08-25 03:30 Zhentiw 阅读(299) 评论(0) 推荐(0) 编辑
摘要:We will learn how to fire up an async request when the route changes. A mock server data: We want to replace localStorge with mock server data, so rem 阅读全文
posted @ 2016-06-08 03:27 Zhentiw 阅读(430) 评论(0) 推荐(0) 编辑
摘要:We will learn how centralized updates in Redux let us log every state change to the console along with the action that caused it. 阅读全文
posted @ 2016-06-07 04:25 Zhentiw 阅读(264) 评论(0) 推荐(0) 编辑
摘要:We will learn how to normalize the state shape to ensure data consistency that is important in real-world applications. We currently represent the tod 阅读全文
posted @ 2016-06-07 04:15 Zhentiw 阅读(297) 评论(0) 推荐(0) 编辑
摘要:We will learn how to encapsulate the knowledge about the state shape in the reducer files, so that the components don’t have to rely on it. In current 阅读全文
posted @ 2016-06-06 21:08 Zhentiw 阅读(218) 评论(0) 推荐(0) 编辑
摘要:We will learn how to avoid the boilerplate code in mapDispatchToProps() for the common case where action creator arguments match the callback prop arg 阅读全文
posted @ 2016-06-06 03:21 Zhentiw 阅读(503) 评论(0) 推荐(0) 编辑
摘要:We will learn how to use withRouter() to inject params provided by React Router into connected components deep in the tree without passing them down a 阅读全文
posted @ 2016-06-06 03:11 Zhentiw 阅读(1076) 评论(1) 推荐(1) 编辑
摘要:We will learn how adding React Router shifts the balance of responsibilities, and how the components can use both at the same time. Now when we click 阅读全文
posted @ 2016-06-06 02:50 Zhentiw 阅读(449) 评论(0) 推荐(0) 编辑
摘要:We will learn how to change the address bar using a component from React Router. In Root.js: We need to add a param to change the Route: (:filter) mea 阅读全文
posted @ 2016-06-04 16:03 Zhentiw 阅读(312) 评论(0) 推荐(0) 编辑
摘要:We will learn how to add React Router to a Redux project and make it render our root component. Install: Router should be wrapped inside Provider, the 阅读全文
posted @ 2016-06-04 15:35 Zhentiw 阅读(275) 评论(0) 推荐(0) 编辑
摘要:We will learn how to better separate the code in the entry point to prepare it for adding the router. Currently, in the index.js, we configure the sto 阅读全文
posted @ 2016-06-04 04:12 Zhentiw 阅读(283) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示