React: Finding Elements by className

March 3, 2023 Snowball

In React, you can find elements with a certain className using the document.getElementsByClassName() method: If you only to get the first element in a bunch of elements that have the same className, do like so: For…

React: How to Disable a Button after One Click

March 3, 2023 Snowball

This example below shows you how to disable a certain button after it is clicked once in React. This can be useful in cases where you want to prevent the user from repeatedly clicking it multiple…

Displaying the Current Year in React

March 3, 2023 Snowball

In React, you can render the current year like this: The complete example below presents a copyright symbol along with the current year (you can see this everywhere on the internet). Screenshot: The code: Further reading:…

React: Using forEach()/for…of to Render a List

March 3, 2023 Snowball

When you need to render an array of objects in React, the most popular solution is to use the Array.map() method. However, there are other possible ways to get the same result, such as using the…

2 Ways to Merge Objects in TypeScript

August 16, 2022 Snowball

This quick article shows you 2 different approaches to merging 2 or more objects in TypeScript. Without any further ado, let’s get our hands dirty. Using the spread operator There are some important things you need…

2 Ways to Extend Types in TypeScript

August 16, 2022 Snowball

This short and straightforward article shows you a couple of different ways to extend a type in TypeScript. Without any further ado, let’s see the code. Using the “extends” keyword Example: Using the “&” operator Example:…

Hero Widget in Flutter: Tutorial & Example

January 5, 2023 A Goodman

This article is about the Hero widget and hero animations in Flutter. We’ll have a glance at the essence of those things and then examine a complete example of using them in practice. The TL;DR In…

React + TypeScript: Using setTimeout() with Hooks

March 3, 2023 A Goodman

This succinct, practical article walks you through a complete example of using the window.setTimeout() and window.clearTimeout() methods in a React application that is written in TypeScript. We’ll use functional components with hooks (useState, useEffect, and useRef)….

React + TypeScript: setInterval() example (with hooks)

March 3, 2023 A Goodman

This practical article walks you through a complete example of using the window.setInterval() method in combination with hooks (useState, useEffect, and useRef) in a React application that is written in TypeScript. No more rambling; let’s unveil…

React: Load and Display Data from Local JSON Files

March 2, 2023 A Goodman

This practical, succinct article shows you how to load and render data from a local JSON file in React. Without any further ado, let’s get started. Importing Local JSON Files In a React project created with…

Flutter: Get the Position of a Tap (X & Y coordinates)

August 12, 2022 A Goodman

This short and straightforward article shows you how to get the location (X and Y coordinates) of a tap in Flutter. The TLDR What you need to do is to wrap your entire screen (or a…

How to Create a Word Counter in React (with Hooks)

March 2, 2023 A Goodman

This practical article shows you how to create a word counter in React (in addition, we’re going to add a character counter, since it doesn’t take much effort). A Quick Note There is a common pitfall…

1 5 6 7 8 9 79