TypeScript Example: Default Function Parameters

August 15, 2021 A Goodman

The code snippet below shows you how to use default function parameters in TypeScript: Output: Important note: The parameters for which you don’t accept default arguments have to come first (stay on the left side). Further…

React + TypeScript: Using Inline Styles Correctly

July 29, 2021 A Goodman

When using inline styles in a React project that is written in TypeScript, you may encounter some annoying problems. For example, the code below: will result in an error like this: Similar errors can also occur…

React + TypeScript: Create an Autosize Textarea from scratch

June 8, 2022 A Goodman

This article walks you through a complete example of making an autosize (or auto-resize) textarea in a React project that uses TypeScript. We will use modern React with functional components and the following hooks: useState, useEffect,…

React + TypeScript: Handling Select onChange Event

June 8, 2022 A Goodman

A select element is a drop-down list with multiple options. In this article, we will examine an end-to-end example of handling the onChange event of a select element in a React web app that written with…

React + TypeScript: Handling onFocus and onBlur events

June 8, 2022 A Goodman

This article walks you through a complete example of handling the onFocus and the onBlur events in a React project that is written in TypeScript. We are going to use modern React features like hooks and…

React + TypeScript: Handling form onSubmit event

June 8, 2022 Augustus

The example below shows you how to handle the form onSubmit event in React with TypeScript. We will use the new things, including functional components and hooks, and not use class-based components. Example Preview Our sample…

1 2 3