TusharShahi

TusharShahi @tusharshahi

About: Software Engineer. Writes about Javascript, React, performance, security,

Location:
Bangalore, India
Joined:
Oct 10, 2020

TusharShahi
articles - 22 total

HTML Text Fragments 🪄

In HTML, every anchor link acts as a bookmark on the page. Besides acting as a link to another page,...

Learn More 1 1Jun 17

Transient Activation: Why the copy button did not work on iPhone

Introduction We recently faced a weird bug at my previous company: our app's copy button...

Learn More 1 0May 23

🧠 JS Pop Quiz: ⚡️Faster iterations

Can you make a one-liner change to the below to ~100x its performance? const ans = hugeArray ...

Learn More 2 0Apr 12

[Boost]

Understanding CVE-2025-29927 - The Next.js Vulnerability ...

Learn More 0 0Apr 5

Understanding CVE-2025-29927 - The Next.js Vulnerability

I love working with Next.js and have used it in projects since version 10 came out. The release of...

Learn More 1 0Apr 4

The convenience of CSS's new @position-try

CSS anchor positioning came out some time ago. If you, like me, do not like writing CSS, this new API...

Learn More 1 0Oct 16 '24

UI Blocking behaviour: microtasks vs macrotasks

Can you find the difference between the two code snippets below: function handleClick1() { ...

Learn More 1 0Aug 30 '24

TypeScript Tip #3: Folder-wise config

The file tsconfig.json indicates that the project is using typescript. It specifies the different...

Learn More 4 0Apr 25 '24

TypeScript Tip #2: valueof

While working on a TypeScript project, it is a common ask to restrict a type of variable to the value...

Learn More 2 0Apr 16 '24

TypeScript Tip #1: forEach vs for loop

While working on a typescript project, it is recommended to enable noUncheckedIndexedAccess for safer...

Learn More 2 0Apr 14 '24

Cost of unnecessary Optional Chaining (and Nullish coalescing operator)

If you are a developer who has worked with JavaScript in recent years, I am sure you are well aware...

Learn More 3 0Apr 6 '24

Polyfill: Array.prototype.flat() without recursion

Array.prototype.flat() is a common polyfill interview question for junior JavaScript Engineers. It...

Learn More 0 0Mar 30 '24

React Redux: Why your app re-renders even when it should not

Introduction React-Redux, although a little heavy, is still a wonderful library to work...

Learn More 1 0Jan 29 '24

Using Suspense with React: without a 3rd party library

The basics Some time ago, React came out with Suspense and has changed the way data...

Learn More 7 2Jan 19 '24

Is React un-optimized?

I recently saw a question in StackOverflow which had the below code snippet: export default...

Learn More 1 0Jul 13 '23

Ternary Operator and Logical &&

Some time ago, I put a comment during a code review which led to a bug in our React Native App. I...

Learn More 1 0Jun 6 '23

Custom React hook : useDebouncedEffect()

Background Recently I saw a question on Stackoverflow where the poster was looking to run...

Learn More 6 0Oct 17 '22

XSS: Problem with allowing users to upload SVG

Allowing a user to upload stuff is cool. One customer-facing app I worked on, allowed users to upload...

Learn More 3 0Oct 7 '22

Breaking: Fast Refresh for .env files in Next.js 12.3

Next.js 12.3 is out with a new set of improvements. A feature that will definitely save me a lot of...

Learn More 7 0Sep 11 '22

Polyfill: Create your own curry()

Saw this question in an interview some time ago: Create a method curry that when passed in a...

Learn More 5 6Sep 10 '22

Polyfill: Create Promise.five()

Polyfill questions are common in Javascript interviews. Some of the most common...

Learn More 5 0Aug 23 '22

Implement Dark/Light mode: How to fix the flicker of incorrect theme?

Some time ago, I created my portfolio website using React + Next.js. I also added a dark mode toggle...

Learn More 12 4Aug 21 '22