Loading tutorials
useState hook. You also need a basic idea of when React re-renders a component. By the end, you will be able to create a context object, decide where it lives in your project, and 5 min readuseState hook. You should also know the basic idea that React re-renders a component when its state or props change. Earlier chapters introduced the prop drilling problem and createContext. Here y5 min readuseState. You should also know that createContext, a Provider and useContext work together. This chapter covers one argument: the value you pass to createContext.4 min readuseContext reads a context value, how React decides which value a component gets, and the errors people most often hit. It assumes you know JavaScript ES6 syntax, React function components, JSX, props, and the useState hook. It also assumes you know that React re-renders 5 min readuseState, and have already created a context, supplied a value with a Provider, and read it with useContext. Here you will learn how React picks a value when several Providers of the same context are stacked, and how to use that t4 min readuseState. You should also know that a component re-renders when its state or props change. You have already seen createContext, Provider and useContext. Here you will use them to share values th6 min readcreateContext, Provider and useContext at a basic level, and that you know useState and how a parent re-render normally re-renders its children. Here you will learn exactly which components re-render when a context value changes, and which ones do not. The next 5 min readcreateContext, Provider and useContext, and that you can share state through a provider. It also assumes you know that a component re-renders when its state, props or parent change. You should have seen useMemo and useCallback before.5 min readcreateContext, Provider and useContext. It also assumes you know useState, and that you can predict when a component re-renders. By the end you will be able to hide a context behind two exports: a provider component and a custom hook.5 min readcreateContext, Provider and useContext. You should also know how to put useState inside a provider component and why a new object passed as value re-renders every consumer. This chapter adds useReducer to that setup. If you haven't used useReducer, the short version is 4 min readuseState, useReducer, createContext, useContext, and how a Provider's value triggers re-renders. It also assumes you have seen useMemo and useCallback. Here you will learn to divide one large context into several smaller ones, so a change in one piece of d5 min readuseContext, and that you know why a state change re-renders a component and its children. Context is easy to reach for, so this chapter covers the cases where something else fits better. The alternatives are plain props, component comp6 min readuse. It can read a context, and it can also read a promise. This chapter covers the context case: what use(Context) does, how it differs from useContext, and where it works and where it doesn't.6 min read