Skip to main content

Posts

Showing posts with the label startTransition

useTransition and startTransition feature in React.js version 18

Introduction This post will give a simple application that can leverage the useTransition and startTransition feature in react.js version 18 and higher. Transitions The transitions are the one that are executed to indicate a change in state from one to the other. For example, in a user listing component, we might have a transition to happen whenever the user tries to filter / sort the data from the grid. React.js has enabled these to be tracked because it involves mostly a user activity to transition from one state to the another state. Why does react.js want to capture or perform these transitions? The main reason for this is to optimize the rendering of the DOM which is a complex and time consuming process. Example Let us consider a scenario where the developer builds a react.js application (like the one in my sample code) which filters a grid of user's from the input captured through a text box. Note: This sample is not following the best practice because in real-time apps, we w