TypeScript

React TypeScript CheatSheet

Typescript cheat sheet for react functional components. useRef const divRef = useRef<HTMLDivElement>(null); setState const SkillSection = ({setScrollDuration} : {setScrollDuration: (value: number) => void}) =>... Read more »

Supabase Auth: Get Currently logged user id

Get the user id of current active user in supabase. Supabase auth logged user's id get. Supabase next js code to get current logged... Read more »

Class Validator: React JS Form Validation Example Code

Validating input fields in React TypeScript App using class validator npm package - example code. Validating length and other parameters for input field and... Read more »

How to Run and Test React Apps on Android, iPhones

Run React Apps on smartphones - Android and Ios devices. Access the localhost with a port number on our mobile devices to run and... Read more »

Create new React App with TypeScript Template

How to create a new React App using TypeScript with help of npx create-react-app. We can easily create a new TypeScript React App with... Read more »

TypeScript: Generic type definitions

Generic type definitions in TypeScript are useful in certain cases with function definitions. In some cases the function may accept any type of input... Read more »

TypeScript: Type Definition for Functions

In typescript, we have to define types for a function definition. It may include type definitions for function parameters and type for the function... Read more »

TypeScript: Type Alias – to avoid duplicate type definitions

To avoid duplication or repeated type definitions, we have the type alias in TypeScript. We can do this easily using the type keyword in... Read more »

TypeScript: Union Types – Multiple types for a variable

Union Type definition in TypeScript allows us to have multiple types for a variable. For example, we can have the type of string and... Read more »

Type Inference inTypeScript – Defining Inferred type

TypeScript tries to infer as many types as possible by default in certain cases. It tries to know which types are used without us... Read more »