Loading tutorials
useState, props, and async/await. It explains the React 19 idea of an Action, because useOptimistic only behaves correctly inside one.3 min readuseState, props and lifting state up, and async/await. It also assumes you have sent data to a server with fetch or a server function. Here you learn the hook's shape and the simplest way to use it. Later chapters cover the update function and failure handling.3 min readuseState, props, and async/await. It also assumes you have seen useOptimistic called with one argument. Here you will learn the second argument: the update function.3 min readuseState, props, and async/await. It also assumes you have met useOptimistic and Actions in earlier chapters. The goal here is to explain one behavior: you never write code that undoes an optimistic update. React discards it for you, and knowing when it does so 3 min readuseState, props, and async/await. It also assumes you have seen the useOptimistic signature, which takes real state and returns optimistic state plus a setter. Here you will see why a form action is the easiest place to call that setter.2 min readuseState, props, async/await, and the basics of useOptimistic and form actions from the earlier chapters. Here you combine them into one working message thread.2 min readuseState, props, and async/await. It also assumes you have read the earlier chapters on the useOptimistic signature, the update function, and form actions.3 min readuseState, props, async/await, and how a form action calls a server function. It also assumes you have read the earlier chapters on useOptimistic and on how the optimistic value is replaced by real state.3 min readkey matters. It also assumes you have built the optimistic message list from the earlier chapters. Here you will fix a detail that code like that often gets wrong: where an optimistic item's key comes from.3 min readuseOptimistic with an update function, and that the optimistic value reverts when the Action finishes. It covers what happens when the user triggers a second update before the first one has finished.3 min readuseOptimistic, Actions, and the automatic revert from earlier chapters. It also assumes you are comfortable with async/await and useState. It covers when to skip the hook.3 min read