随笔分类 -  React

上一页 1 2 3 4 5 6 7 8 9 10 ··· 23 下一页
摘要:Error Boundaries are the way you handle errors with React, and Suspense embraces this completely. Let's take a look at how to handle asynchronous erro 阅读全文
posted @ 2020-09-02 15:00 Zhentiw 阅读(819) 评论(0) 推荐(0)
摘要:React is really good at creating and updating DOM elements, but sometimes you need to work with them yourself. A common use case for this is when you’ 阅读全文
posted @ 2020-09-01 19:05 Zhentiw 阅读(149) 评论(0) 推荐(0)
摘要:Something that’s important to recognize is that every time you call the state updater function (like the setName function in our component), that will 阅读全文
posted @ 2020-09-01 18:54 Zhentiw 阅读(135) 评论(0) 推荐(0)
摘要:Sometimes you have some boilerplate for components that would be nice to abstract away slightly with a simple helper function. In this lesson we'll le 阅读全文
posted @ 2020-09-01 15:30 Zhentiw 阅读(133) 评论(0) 推荐(0)
摘要:Returning null will not update state and trigger a component re-render Example: updateMocktail = mocktail => { const newMocktail = mocktail; this.setS 阅读全文
posted @ 2020-09-01 15:10 Zhentiw 阅读(166) 评论(0) 推荐(0)
摘要:You can have a Box element, which just used for create other element or layout: // example Box.js import styled from 'styled-components' import { spac 阅读全文
posted @ 2020-08-25 01:55 Zhentiw 阅读(180) 评论(0) 推荐(0)
摘要:In this lesson we’ll improve a generic button primitive component by refactoring it with Styled System to simplify the implementation. The naïve style 阅读全文
posted @ 2020-08-23 03:02 Zhentiw 阅读(371) 评论(0) 推荐(0)
摘要:Similar to Storybook, react-styleguidist is used to show the custom UI elements. It is easy to setup and use, it uses markdown file as example page: i 阅读全文
posted @ 2020-08-20 22:55 Zhentiw 阅读(265) 评论(0) 推荐(0)
摘要:In this lesson, we're going to show how RecoilJS selectors are used to display computed data in React. While atoms are the go-to state objects in Reco 阅读全文
posted @ 2020-08-12 02:40 Zhentiw 阅读(242) 评论(0) 推荐(0)
摘要:We have a message app: function App() { const messageDisplayRef = React.useRef() .... const scrollToTop = () => messageDisplayRef.current.scrollToTop( 阅读全文
posted @ 2020-07-21 15:26 Zhentiw 阅读(331) 评论(0) 推荐(0)
摘要:Instead of just returning a value from a recoil selector, you can return any promise, which means that you can do asynchronous functions in recoil sel 阅读全文
posted @ 2020-06-17 20:12 Zhentiw 阅读(411) 评论(0) 推荐(0)
摘要:Environment variables are a standard way to configure variables in your app based on the current environment (development, test, production). This les 阅读全文
posted @ 2020-06-02 01:05 Zhentiw 阅读(188) 评论(0) 推荐(0)
摘要:const useResetScore = () => { const [score, setScore] = useRecoilState(gameScore) return () => { setScore(0) } } ... const resetScore = useResetScore( 阅读全文
posted @ 2020-05-17 02:57 Zhentiw 阅读(215) 评论(0) 推荐(0)
摘要:Recoil allows us to use atoms in order to store pieces of state. More often than not in our apps we need to use data that derives from our application 阅读全文
posted @ 2020-05-16 19:03 Zhentiw 阅读(297) 评论(0) 推荐(0)
摘要:Recoil is a brand new state management library for React developed by Facebook. In this quick lesson we're going to learn how to add it to a React app 阅读全文
posted @ 2020-05-16 16:34 Zhentiw 阅读(232) 评论(0) 推荐(0)
摘要:Folder structure: | __mocks__ | api | pet.js | src | api | pet.js __mocks__/api/pet.js // __mocks__/api/pet.js import { readFileSync } from 'fs' impor 阅读全文
posted @ 2020-05-12 18:10 Zhentiw 阅读(204) 评论(0) 推荐(0)
摘要:As a beginner of React, might have the confuses with 'useMemo' and 'React.memo': 'useMemo': When using functional components in React we may run into 阅读全文
posted @ 2020-05-07 20:06 Zhentiw 阅读(339) 评论(0) 推荐(0)
摘要:For development, we'll be using a separate server address to reach our REST endpoints. In a production build, this will likely be a different address, 阅读全文
posted @ 2020-05-05 02:55 Zhentiw 阅读(178) 评论(0) 推荐(0)
摘要:It's always important to test your code, especially if you're open-sourcing it for others to use. In this video, we'll learn how to use react-hooks-te 阅读全文
posted @ 2020-05-04 18:47 Zhentiw 阅读(212) 评论(0) 推荐(0)
摘要:When you use a React Portal, much of your component can be rendered outside the main DOM tree. Let’s see how we can use utilities provided by React Te 阅读全文
posted @ 2020-05-04 02:10 Zhentiw 阅读(701) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 10 ··· 23 下一页