随笔分类 - React
摘要:Forms in React are not easy. T hey are verbose and several lines of code. However, forms with Formik are much simpler. Formik maintains the state of i
阅读全文
摘要:Got the idea form this lesson. Not sure whether it is the ncessary, no othere better way to handle it. Have a TodoList component, every time types in
阅读全文
摘要:As an alternate to useState, you could also use the useReducer hook that provides state and a dispatch method for triggering actions. In this lesson,
阅读全文
摘要:In the class version of this component, we had a method called safeSetState which would check whether the component was still mounted before trying to
阅读全文
摘要:Thanks to react-testing-library our tests are free of implementation details, so when we refactor components to hooks we generally don't need to make
阅读全文
摘要:We have a render prop based class component that allows us to make a GraphQL request with a given query string and variables and uses a GitHub graphql
阅读全文
摘要:We would like the ability to group a series of actions to be dispatched with single dispatching functions used as handlers in various parts of our gam
阅读全文
摘要:With our Redux implementation lousy with State ADT based reducers, it is time to hook it all up to a React Shell. Having already built out some UI/UX
阅读全文
摘要:If the user hasn't used your application for a few minutes, you may want to log them out of the application automatically in case they've stepped away
阅读全文
摘要:We sometimes just want to return a couple of elements next to one another from a React functional component, without adding a wrapper component which
阅读全文
摘要:It's important that our users enjoy using our application or website. One way we can make it happen is by adding microinteractions to subtly reward ou
阅读全文
摘要:On Android and in Chrome (but not on iOS), it's possible to send push notifications with a PWA. We'll start by asking the user for permission to send
阅读全文
摘要:It's possible to access some, but not all, of the native device features from a PWA. One that we canaccess, is the camera and camera roll. We'll use t
阅读全文
摘要:The default service worker that comes with create-react-app doesn't allow for very much configuration. We'll replace that default service worker in tw
阅读全文
摘要:Transpile Modules with Babel in Jest Tests Jest automatically loads and applies our babel configuration. However, because our project takes advantage
阅读全文
摘要:It can be incredibly frustrating to spend a few minutes filling out a form only to accidentally lose all of your progress by the browser closer, the p
阅读全文
摘要:The AbortController interface enables us to cancel a one or more DOM requests. In this lesson, we will demonstrate how to use the controller to cancel
阅读全文
摘要:A new Higher Order Component (HOC) was recently released in React v16.6.0 called React.memo. This behavior of the HOC is similar to what you’d get whe
阅读全文
摘要:In this lesson I demonstrate how to use the library MDXC to create and import React components with Markdown. MDXC converts markdown into JavaScript a
阅读全文
摘要:In this lesson, you will learn how to extend styles from one styled-component to another in a React app. This is helpful when you have two styled-comp
阅读全文