useRef

Understanding the useRef React hook

Understanding the useRef React hook

  • January 21, 2021

Continuing our React hooks series, we will learn about the useRef React hook in this blog post. The useRef React hook is useful in the following two situations: Before we see these advantages of the hook, let us first understand what the hook is and what it does. What is...

Use redux-like middleware for useReducer in React

Use redux-like middleware for useReducer in React

  • January 14, 2021

If you have used Redux before, you would be aware of the concept of middlewares. Now that useReducer has become a commonly used react hook, we might want to replicate the idea of middleware for the useReducer hook as well. If you do not know about middlewares, middlewares are functions...

Detecting click outside component using React hooks

Detecting click outside component using React hooks

  • November 10, 2020

If you have tried developing your own dropdown, modal, or popover in React, you would have come across this. “How do I detect a click outside my react component so that I can close it?” Detecting click outside component is luckily is not that difficult. This post will use react...