logo

Blog Posts

Welcome to my blog! Here youll find articles, tutorials, and insights on web development, programming, and technology.

image

Optimizing Data Fetching in React using React.use

When working with React component, managing data fetching efficiently is crucial to providing a smooth and responsive user experience. In many cases using React.use or React.useEffect for fetching data can lead to multiple redundant requests, impacting both performance and resource usage. In this post, we’ll explore how to implement a custom caching mechanism to prevent unnecessary fetches while using React.Suspense and React.ErrorBoundary to handle loading states and errors.

5 min readRead More
image

Event Capturing and Bubbling in React

When working with React, understanding how events propagate through the DOM is crucial for building interactive and responsive user interfaces.

5 min readRead More
image

Understanding React's flushSync API

React's automatic batching of state updates is a powerful feature that optimizes performance by reducing the number of re-renders. However

9 min readRead More
image

Unlocking the Power of Imperative Handles

When working with React, sometimes we need allows child components to to expose certain function or properties to the parent component or other child components

5 min readRead More
image

Controlled and Uncontrolled Components

Controlled components and uncontrolled components are two ways to manage form data. In a controlled component, the form data is handled by a React component. The form data is stored in the component's state and is updated through the component's setState method. the benefit of using a controlled component is that you have full control over the form data. You can validate the form data, manipulate the form data, and perform other operations on the form data. In an uncontrolled component, the form data is handled by the DOM itself. The form data is stored in the DOM, and is accessed through the DOM's API. In an uncontrolled component, the component does not manage the form data directly. the benefit of using an uncontrolled component is that you do not need to write as much code as you would with a controlled component. or for simple form with limited interaction You can also use uncontrolled components to integrate with third-party libraries that require direct access to the DOM. However, uncontrolled components are not as flexible as controlled components, and you may run into issues with form data

5 min readRead More
image

Higher Order Components in React (HOC)

The Higher Order Component (HOC) Pattern in React is a design pattern that allows you to reuse component logic. A higher-order component is a function that takes a component and returns a new component with additional props. HOCs are a powerful tool for code reuse and abstraction in React.

5 min readRead More
image

Understanding React Keys and Their Importance

The key prop in React uniquely identifies elements within a list or dynamically rendered components. It ensures React can track which elements have changed, been added, or removed, allowing for efficient DOM updates.

5 min readRead More
image

Latest React Features You Should Know

The Latest Ref Pattern enables you to reference the most recent value of props, state, or callback without including it in the dependency array when using it inside a useEffect

5 min readRead More
image

Understanding React createPortal in depth

React.createPortal is a method provided by React to render components outside the DOM hierarchy of their parent component. It allows you to mount a child node into a different part of the DOM, independent of where it is declared in your React component tree.

3 min readRead More