Avoid any Type in TS (anti-pattern)
What are types in TS? Types in TS helps us understand what methods & properties are associated with a given value/variable in a program that can help us analyze our code for existing errors and prevent further errors. For example a value that is assigned a type of a string tells us that the value…
Using index as a key in React (anti-pattern)
What are lists in React ? Lists are used to display data which are similar in ordered format . Often they have same type i.e an array of similar kind of data rendered into a list tag using some version of for loop. How does react render lists? DOM Before we learn how react renders lists…
Utility Types in TypeScript
What are utility Types? In TypeScript, utility types are built-in types that allow you to manipulate and transform existing types. They can be used to extract, exclude, or modify the properties of an existing type, or to create a new type based on an existing one. TypeScript provides several utility types to facilitate common type…
Common Anti-patterns with React
Nested components When a component is defined inside another component, it creates a tight coupling between the two components, meaning that they are highly dependent on one another. This can make it difficult to reuse or re purpose the inner component. Also when the parent component re-renders , the inner component will be defined again…