Cristian Salcescu's Blog

June 14, 2023

Showing Any Playing Card From a Deck With Elm

Defining custom types, using records, mapping cards records to Unicode characters, and more

Continue reading on Frontend Essentials »

 •  0 comments  •  flag
Share on Twitter
Published on June 14, 2023 23:09

March 8, 2023

Generating Random Numbers and Strings

Quick start with Math.randomPhoto by the author

How would you generate a random number? What about a random string?

You may already know the built-in Math.random function. It generates a random number between 0 and 1, not including the 1 number.

Generating a Random Number

Below is an example of using this utility.

const no = Math.random();
console.log(no);
//0.9045660913804647

As you can notice the given result is a decimal number.

How can we generate an integer number in a specific interval?

To get a num...

 •  0 comments  •  flag
Share on Twitter
Published on March 08, 2023 01:54

February 24, 2023

State Management with React Hooks

The book is available in kindle format

The State Management with React Hooks book is available in kindle format.

State management is a common challenge when developing web applications.
This book explores state management with React Hooks by building several small applications.

Here are some of the things we will go through:

Understand what state isManaging form inputsDoing form validationEncapsulating the form state management and validation in custom hooksAdding, deleting, and editing items in list...
 •  0 comments  •  flag
Share on Twitter
Published on February 24, 2023 04:49

October 2, 2022

Picking Playing Cards from a Deck with React Hooks

Maps of Unicode characters, creating and shuffling a deck, and more

Continue reading on Frontend Essentials »

 •  0 comments  •  flag
Share on Twitter
Published on October 02, 2022 23:02

September 30, 2022

How to Create and Delete a Git Branch

Creating and deleting local and remote development branches

Some of the basic things we may need to do when working on a feature involved creating a development branch and then deleting that branch after merging all the changes.

Here is how we can do that.

Creating a Local Branch

Below is an example of creating a new branch new-dev-branch from the master branch.

git checkout -b new-dev-branch masterCreating a Remote Branch

Creating a local branch does not mean that a branch is also created in the remo...

 •  0 comments  •  flag
Share on Twitter
Published on September 30, 2022 04:15

September 29, 2022

September 25, 2022

September 22, 2022

September 21, 2022

About the State Management of a Contenteditable Element in React

Controlled input, onInput event, e.target.innerHTML, and more

Continue reading on Frontend Essentials »

 •  0 comments  •  flag
Share on Twitter
Published on September 21, 2022 23:03

Good to Know About the State Management of a Contenteditable Element in React

Controlled input, onInput event, e.target.innerHTML, and more

Continue reading on Frontend Essentials »

 •  0 comments  •  flag
Share on Twitter
Published on September 21, 2022 23:03