随笔分类 -  React

上一页 1 2 3 4 5 6 7 8 9 ··· 23 下一页
摘要:With React hooks it's common to write callback functions in our component body. Event handlers are a common example of this. Most of the time they wor 阅读全文
posted @ 2021-09-10 20:48 Zhentiw 阅读(92) 评论(0) 推荐(0) 编辑
摘要:In addition to storing DOM references, the useRef hook can be used to store values without re-rendering the component. If you have a class component t 阅读全文
posted @ 2021-09-10 20:33 Zhentiw 阅读(39) 评论(0) 推荐(0) 编辑
摘要:Using React hooks like useState makes it easy to manage things like a shopping cart, but that state may only be available one instance at a time. What 阅读全文
posted @ 2021-02-01 19:37 Zhentiw 阅读(100) 评论(0) 推荐(0) 编辑
摘要:function useState<S>( initialState: S | (() => S), ): [S, Dispatch<SetStateAction<S>>] Example: function useDarkMode() { // ... const returnValue: [st 阅读全文
posted @ 2021-01-26 03:58 Zhentiw 阅读(135) 评论(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) 编辑
摘要:If you find yourself filling out the same form over and over again, or working through a weird workflow to enable certain features in your app just to 阅读全文
posted @ 2020-12-26 18:28 Zhentiw 阅读(110) 评论(0) 推荐(0) 编辑
摘要:You often want to ignore values until the user performs a certain action. This lesson walks through setting up an allowWhen broadcaster that will only 阅读全文
posted @ 2020-11-24 21:58 Zhentiw 阅读(130) 评论(0) 推荐(0) 编辑
摘要:To display a sequence of values in React, we can use our mapSequence operator, wrap it around a broadcaster, then pass that new broadcaster into our u 阅读全文
posted @ 2020-11-19 01:46 Zhentiw 阅读(114) 评论(0) 推荐(0) 编辑
摘要:Instead of always combining useState and useEffect, when can create a utility useBroadcaster hook which allows us to pass in a broadcaster. export let 阅读全文
posted @ 2020-11-17 22:30 Zhentiw 阅读(126) 评论(0) 推荐(0) 编辑
摘要:https://epicreact.dev/css-variables/ Code body[data-theme='light'] { --colors-primary: deeppink; --colors-background: white; } body[data-theme='dark'] 阅读全文
posted @ 2020-11-05 03:56 Zhentiw 阅读(100) 评论(0) 推荐(0) 编辑
摘要:We should always ship fast experiences to our users, but sometimes something slips through our PR review process and our users start having a slow exp 阅读全文
posted @ 2020-10-23 02:43 Zhentiw 阅读(109) 评论(0) 推荐(0) 编辑
摘要:For the follow code: function Cell({row, column}) { const state = useAppState() const cell = state.grid[row][column] const dispatch = useAppDispatch() 阅读全文
posted @ 2020-10-23 02:32 Zhentiw 阅读(110) 评论(0) 推荐(0) 编辑
摘要:The way that context works is that whenever the provided value changes from one render to another, it triggers a re-render of all the consuming compon 阅读全文
posted @ 2020-10-23 00:28 Zhentiw 阅读(102) 评论(0) 推荐(0) 编辑
摘要:const defaultInitialState = {status: 'idle', data: null, error: null} export function useAsync(initialState) { const initialStateRef = React.useRef({ 阅读全文
posted @ 2020-10-23 00:26 Zhentiw 阅读(524) 评论(0) 推荐(0) 编辑
摘要:// Window large lists with react-virtual // http://localhost:3000/isolated/final/04.js import React from 'react' import {useVirtual} from 'react-virtu 阅读全文
posted @ 2020-10-23 00:10 Zhentiw 阅读(321) 评论(0) 推荐(0) 编辑
摘要:To understand lazy loading in React, we need to think in two steps. 1. Use dynamice import: to load script 2. Use React.lazy to load dynammice import, 阅读全文
posted @ 2020-10-22 00:06 Zhentiw 阅读(104) 评论(0) 推荐(0) 编辑
摘要:The useDebugValue hook will not effect your user experience but is instead aimed at improving the developer experience. When building your own custom 阅读全文
posted @ 2020-10-08 02:19 Zhentiw 阅读(128) 评论(0) 推荐(0) 编辑
摘要:Recoil offers several hooks to use for consuming state in React, and this lesson looks at how to choose which hook to use, and what happens when you d 阅读全文
posted @ 2020-09-27 00:55 Zhentiw 阅读(177) 评论(0) 推荐(0) 编辑
摘要:When consuming asynchronous selectors in Recoil, you're going to need to tell React what to render while the API is fetching its data. One way to solv 阅读全文
posted @ 2020-09-13 22:28 Zhentiw 阅读(272) 评论(0) 推荐(0) 编辑
摘要:In this lesson, we're going to learn how to create Recoil selectors that accept arguments. These are made possible using the selectorFamily utility fu 阅读全文
posted @ 2020-09-09 19:10 Zhentiw 阅读(845) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 ··· 23 下一页
点击右上角即可分享
微信分享提示