Loading tutorials
useState, and how to handle events in React. It explains why changing a state object in place fails. The next chapters cover the copy patterns that fix it.5 min readuseState and6 min readuseState, and can handle events such as onChange. It covers how to update object state by building a new object, where shallow copies stop helping, and the errors people hit most o4 min readuseState hook. It also assumes you have seen an event handler that calls a state setter. The previous chapter showed how { ...person, firstName: 'Grace' } builds a new object. Here you will look at what tha5 min read...), and that you can write a React function component with useState and an onChange handler. It also assumes you have seen the basic pattern of updating a flat object: setPerson({ ...person, firstName: 'Grace' }). He4 min readmap, filter, and slice. It also assumes you can write a React function component with useState and handle events. You should already know that React state is a snapshot and that you replace state instead of editing it. Her5 min readuseState, and how to handle events in React function components. It covers how to add items to an array held in state, which approaches fail, and the edge cases that cause bugs.5 min readfilter method, basic function components, useState, and React event handlers. It covers how to remove items from an array held in state, why filter is the right tool, and the errors that come up in practice.5 min readmap as the standard way to replace or change items in an array held in React state. It assumes you know JavaScript objects and arrays, map, filter, and slice, and the basics of function components, useState, and event handlers. Earlier chapters covered adding items with5 min readslice, the spread operator, and the useState hook. You should also be comfortable with React event handlers. By the end, you will be able to insert an item at any index of an array held in state without mutating it. You will also be able to spot t5 min readuseState, event handlers, and the array methods map, filter, and slice. It also assumes you have read the earlier chapters on why state must not be mutated and on shallow copies. Here you apply those ideas to reordering: sorting and reversing arrays held in stat4 min readmap, filter, and slice. It also assumes you can write a React function component that uses useState and handles events. Earlier chapters covered updating a nested object and changing array items wi6 min readuseState works, can write event handlers in function components, and are comfortable with the spread operator and map/filter. It builds on the earlier chapters about state as a snapshot and replacing state with copies.6 min readmap/filter on arrays of objects. It also assumes you know useState and updater functions. Here you will see why those patterns get awkward as state nests deeper, and how to res4 min readuseState and handle events in React. You should be comfortable with the copy patterns from earlier chapters: spreading objects, and using map, filter, and slice on arrays.5 min read