Explaining the useListener Code
lessonDuration 1m 53s
We went through creating custom React hooks to support our callback and closure patterns pretty quickly. Let's take a second to review how everything fits together before we move on.
Browse
Find courses, lessons, articles, talks, and podcasts.
1,542 results for "react"
Showing 1,393–1,416 · Page 59 of 65
lessonDuration 1m 53s
We went through creating custom React hooks to support our callback and closure patterns pretty quickly. Let's take a second to review how everything fits together before we move on.
lessonDuration 1m 57s
We can capture the pattern we created with `useCallback` into our own `useListener` hook. This is essentially copying and pasting the code we wrote, but being very aware of the "dependencies" that `useCallback` requires so that it doesn't destroy our listener each time React renders.
lessonDuration 4m 21s
We’ll install `react-intl`, then add it to the mounting point of our React app. Then, we’ll use `react-intl` helpers to load locales in our app, including English, Spanish and French and choose which locale data to load based on the user's browser language. We’ll also set up and include messages files for each language, which hold all of the translated strings for our app.
lessonDuration 1m 16s
Sometimes our React components render different outputs depending on their local state. In this lesson we will use Enzyme’s `setState` method to test that our component’s rendered output is as expected.
lessonDuration 3m 24s
In this lesson we'll learn how to use raw React APIs to create the most basic Hello World example. React defines it’s own `createElement` function that we will see works similar to `document.createElement`. And in place of `appendChild` we will use `ReactDOM`'s `render` function. We'll also learn a little bit about React props and the children prop.
lessonDuration 2m 58s
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 all the way down as props.
lessonDuration 3m 17sFree
**NOTE:** The `react-cache` API is not stable and has changed. Check [this issue](https://github.com/facebook/react/issues/14780) for more details. Many components in your application will need data that has to be fetched over the network. When that data is loaded, however, you don't want to make a network request because you have the data stored in cache in the browser. React gives us an API to handle cache for us. We can use `createCache` and `createResource` to set data in the cache after fetching over the network.
lessonDuration 2m 1sFree
In this lesson, we’ll write a simple toggle component which will serve as the foundation for the rest of the course. Kent walks through how to create a simple toggle with React setState. He shows us how to extend the functionality of the toggle by safely adding an onToggle prop that gets called after state is updated. It is important to define default props when you are calling a method from props.
lessonDuration 4m 43sFree
[React DevTools](https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi?hl=en) and React's built-in development warnings rely on the `displayName` and `name` property of your react components to give you a good developer experience. Unfortunately, Higher Order Components make it harder for React to give that good experience. In this lesson, we’ll learn about the `displayName` property and how that impacts React Developer Tools. Then we'll improve the `displayName` for our Higher Order Component by changing where we call the withToggle Higher Order Component.
lessonDuration 2m 54sFree
When you wrap a component with a Higher Order Component, it becomes impossible to forward the `ref` prop down the component tree due to the special nature of the `ref` prop in React. In this lesson, we’ll see that problem in action with our Higher Order Component. We will pass the ref as an `innerRef` prop so that the Higher Order Component can re-assign the ref to the component that it is wrapping.
lessonDuration 5m 19s
Hi, here's a short intro to my course about Angular Elements. The goal of this course is to learn about the new Angular Elements API provided by the Angular team. It's a pretty exciting new technology as it allows us to share our Angular components outside of Angular. This opens up a lot of new possibilities, such as fully dynamic components or even including your Angular Elements in applications built with other frameworks such as React or Vue. So in this course we'll walk through the basics, how to create an Angular Element, compile it and how to handle input and outputs. We'll also experiment with including it in a React application, or even use it in an AngularJS (v1.x) app. This is just the beginning as the Angular Elements API is still in its very early stages. I expect a lot of new features coming up with the next major versions of Angular. Enjoy the course
lessonDuration 1m 33s
Storybook is a UI component development environment for React, Vue, and Angular. With that, you can develop UI components without running your app. Here I show how to set up the Knobs decorator in Storybook to make your Storybook stories infinitely interactive based on their props, and not just your predefined Stories.
lessonDuration 1m 21s
React Hooks introduced a number of useful functions, one of which is useContext. It allows you to consume a Context in a function component without using a Consumer directly. This helps to cut down on unnecessary nesting in your components’ JSX, making them easier to read. In this lesson we’ll see how to replace a Consumer with the useContext hook.
lessonDuration 5m 11s
We can separate our custom application code from the common libraries we leverage, such as React and ReactDOM. In this lesson we'll configure `webpack` to treat React and ReactDOM as external dependencies. Then we'll update our HTML template to conditionally include the CDN links for those libraries for production builds.
lessonDuration 4m 5s
In this lesson we'll start with an empty folder and initialize the project that will serve as the base to build up our own React boilerplate project. We'll also initialize a git repository and walk through checking the repo status, adding files, committing and we’ll take a look at the git log.
lessonDuration 3m 36sFree
A new Higher Order Component (HOC) was recently released in [React v16.6.0](https://reactjs.org/blog/2018/10/23/react-v-16-6.html) called `React.memo`. This behavior of the HOC is similar to what you’d get when using `React.PureComponent` or `shouldComponentUpdate` in a React Class Component. However, now with the introduction of `React.memo`, you can leverage this behavior for React Function Components. The end result is that React will skip rendering the component if the props have not changed and will reuse the last rendered result.
lessonDuration 5m 7sFree
If you have a presentation coming up or you just need to present some documentation, then the Code Surfer React component is a powerful way to Highlight, Zoom, and Scroll snippets of code. This component is particularly designed to work with mdx-deck, which is a MDX-based presentation framework that enables easy slide creation with markdown and React components. https://github.com/pomber/code-surfer https://github.com/jxnblk/mdx-deck
lessonDuration 2m 50sFree
In order to display data we first need to fetch it. The Query component allows us to describe which data we are interested and automatically handle the fetching of our data. Once we received the data we can render it using React. Since the Query component handles the data fetching we need to make sure we properly deal with the cases of a loading state as well as when the receive Errors from the GraphQL API. In this lesson we will cover both.
lessonDuration 1m 4sFree
In this lesson, you will learn how to use variables to update local state in React with your Apollo Link State Mutations.
lessonDuration 1m 29s
In React Transition Group, the `<TransitionGroup>` component uses a standard `<div>` as its container element. This can be changed to whichever HTML element you like. This can be very important for accessibility and maintaining DOM readability. We can also pass `null` as the `component`, which means no container element is used at all. This can be important for styling.
lessonDuration 1m 10s
In React Transition Group, enter and exit transitions occur by default. However, sometimes that may not be the required behaviour. In this lesson, let’s take a look at how to change this behaviour, using the `enter`, and `exit` props.
lessonDuration 1m 19s
Thanks for checking out this course! My goal is for you to be able to use the patterns described in this course to make your components more flexible and easy to use. Many thanks to Kent C. Dodds for his Advanced React Component Patterns course which was a big inspiration for this course. This course covers patterns that make a component's state, logic or ui configurable by a parent component. The patterns include: Compound Components, Provider Components, TemplateRefs and State Reducers. I hope you enjoy this course as much as I did making it.
lessonDuration 3m 43sFree
Threading props down through a bunch of components that don't care about them is not only sad, but it also tightly couples those components to their locations in the hierarchy. React 16.3's Context API makes it possible to pass props down multiple levels *invisibly, behind the scenes*, and gives you new ways to organize your data. This lesson covers how to take a React app with multi-level "prop drilling" and refactor it to use the Context API. We also cover how to create a context provider component to contain related state, and keep it abstracted away from other parts of the app.
lessonDuration 2m 43sFree
When you bring up the on screen keyboard in a mobile app, it will cover any text input or buttons on the bottom half of the screen, which can be frustrating for users. There are a few common ways to deal with this in React Native - and this video shows the following solutions: First, you can use the built in `KeyboardAvoidingView` to move components around when the keyboard comes on screen. It has the advantage to being built in to React Native already - but it can be overly complicated to get this approach to work consistently across both iOS and Android. There is also a third party library called `KeyboardAwareScrollView`, which will allow your entire view to scroll, and will keep the currently selected text inputs up and out of the way of the keyboard.