React train the trainer

Introduction

Who am I?

Who are you?

Before we start

Topics

Basics of modern web development

A short journey through time

→ Increasing app complexity leads to pressure on developers to create tools for simplification.

→ Result: Compilers, frameworks, build chains, programming languages

Node.js & npm

Exercise: Initialize your project
  1. Open a terminal in the folder that should contain your project folder.
  2. Run npm create vite@latest and select the React & TypeScript preset. This will create a new folder with our new web project.
  3. Navigate into the folder and run npm i to install the project dependencies.
  4. Run npm run dev to start our application and open it in a browser.
Exercise: Cleanup your project
  1. Now that we have everything set up, let's first clear everything that we do not need at the moment
  2. Delete everything inside of the src folder, except main.tsx and vite-env.d.ts.
  3. Remove everything from main.tsx and add a console.log('Hello World') and make sure this runs in your browser (even if you have a red underline under "console").
Tour through the project
Bundlers

TypeScript

Some examples
Exercise: First steps in TypeScript
function isPrime(n: number) {
  const end = n ** 0.5;
  for (let i = 2; i < end; i++) {
    if ((n / i) % 1 === 0) return false;
  }
  return true;
}

const cached = memoize(isPrime);

// Calculates for 10
cached(10);

// Calculates for 5
cached(5);

// Directly reuses the previous result for 10
cached(10);

First steps with React

JSX

Exercise: Render your first element
Rules of JSX

Components

Exercise: Your first components

Data driven UIs

Exercise: Reusing components

Interactive applications

Events & States

Exercise: Make your app interactive
How state works

Controlled & uncontrolled components

State antipatterns

Exercise: Building your first form

Leaving the pure world of React

Async IO

Data-fetching

Data fetching and type safety
Promises
Exercise: Building some data loading functions for https://pokeapi.co/

useEffect

Exercise: Displaying pokemon
The cleanup function
Exercise: Playing around with effects

Ground rules of React

Ecosystem

State management

Styling

Rendering modes and meta frameworks