And then what are the options for this? So we have what React is pointing to, which is evolving to, which is a more declarative model, where you describe the changes before and after, and you let the computer figure out the steps in between. So if you're like me, you're probably already using, and if you're not, I want you to start to use today, the use action state, for example, for forms, where we can use this hook to describe the state of a form. We have the previous state and the form data, and here we have a more declarative model to express our changes. Here, we do the data fetching and we return, and then if something fails, we propagate the failure. So here we have in a form a much better way to detect those changes without blocking each other, right? And this is, for sure, a bigger paradigm shift, because before, imagine in applications, in real cases, you're going to probably have lots of forms.
Just think about lots of try catchings every time. So if you're like me, my company, nowadays we have this chatbot, so tons of forms to change. So this, for us, was very impactful to understand and to bring to place. So with React 19 and going onwards, we can see that we're moving towards declarative everything, not just, you know, like state, like forms, data fetching, metadata, everything that used to be imperative. Now it's becoming more declarative and this is changing, and that carries over even more to the latest 19.2 update. So we have last October another very good update from React where we introduced new APIs, and I think they are super interesting, and I want us to adopt them. So here in this new update, I separate things that I think that's very important for us to bring to the table and how we can go about them.
So here is more or less what we're going to see today. So we're going to have the activity, the user effect event, and we have some performance updates as well. And where do we begin? Right, so let's start by the React compiler. If you see my latest talk and the previous React Summit, you probably know that I'm all about the React compiler. I think React compiler brings to you the biggest return of investment because with one line of code, you can do so much. But to recap, I would like to go through the steps that I take every time that I'm explaining the compiler because I know the sensitive topic as well. A lot of devs are very much afraid to touch the compiler and understandably, it can seem a lot. But once you understand how things work and actually that you can get even more power than just manual memorization, you can clearly see the step by step how to approach this kind of change. So probably if you're like me, you also learn from before how to take your components, take your actions, and make the memory safe, basically memorizing everything. So for the derived data, you used to have the used memo, which you can, you know, memorize the results of the derived data for the handlers. You know, you can have used callback to memorize our callbacks. And for the component itself and the children, we have the React memo, which was, you know, in charge of the memorization and everything else. That is OK. And you know, we see nowadays that a lot of frameworks evolved and they have this baked by default and what React did, you know, it brought to us that API to deal with this stuff. First of all, the name is a bit confusing. We have used callback, used memo and React dot memo. And it is prone to error. Right.
Comments