Search smart in VSCode using regexI was in the middle of writing a unit test case for some service built-in JavaScript using Jest. We need to mock data instead of actually having a connection using a database instance. In particular model response json data, I need to search for a pa...1 min read·nsblog.hashnode.devNov 6, 2023
TIL #4: Why React Component re-renders in Strict modeToday, while doing my day-to-day tasks, I come to observe that my API call in useEffect runs twice, I knew that it was re-rendering because of the local state changes inside the component, but it was not the case, in the first place the useEffect was...1 min read·nsblog.hashnode.dev1THJul 10, 2023
What is Immutability in React?Objects are mutable in nature, but while working in React we need to create a copy of the object so that comparison can be done.3 min read·nsblog.hashnode.dev3MLOFeb 1, 2022
TIL #3: Early Returns/Guard Clauses in JavaScript (and React)Early Return is a pattern that suggests we avoid nested if-else statements by checking the preconditions and return or throw as early as possible. Usually,1 min read·nsblog.hashnode.dev6LOKDec 14, 2021
TIL #2: How to Conditionally Add Props to a React Component?Sometimes we need to avoid passing the entire prop key based on some condition, the conditional spreading here to rescue.1 min read·nsblog.hashnode.dev1RDec 9, 2021