We will use:
Source code: d-dmytro/my-typescript-app
Let’s create a folder for our project:
npm init to create the package.json file in this folder. I’ve chosen defaults for the options.
Let’s install TypeScript and the types for Node.js as dev dependencies.
npm i -D typescript @types/node@12
I installed the types for Node.js 12 because that’s the version I’m using in this project. …
My goal in this tutorial is to show how to structure React components around forms. In order to demonstrate this, I’d like to build a simple Newsletter subscription form.
The form contains the email address input and the submit button. Once the user submits the form, we should validate the email and display an error message if the validation fails. If validation succeeds, we display a success message. Simple, hah?
I’d split this form into 3 React components:
We can use a nice perl one liner in the terminal to process files line by line. We can do many interesting things with it:
Lets go through a few examples. I created a file with a list of animals and named it animals.txt:
First, lets replace lion with Lion King in the content of this file:
perl -p -e '$_ = qq(Lion King\n) if /lion/' animals.txt …