react-training-slides

[fit] Rangle.io

[fit] React Training

Prerequisites

  • Access to the command line

  • Node.js (v6 or higher)

  • NPM (v3 or higher)

  • Code editor (Sublime, Atom, etc.)

  • Some JavaScript knowledge (ES5/ES6)

Overview

  • ES6

  • Light functional JavaScript

  • From jQuery to React

  • Thinking in Components

  • create-react-app

  • Components

    • JSX

    • State & Props

    • Stateless components

    • Stateful components

    • Lifecycle methods

    • PropTypes

    • DOM mounting

  • REST API (fetch)

[fit] 🤷🏽‍♂️ Ecmascript 2015

[fit] Functional Programming

[fit] with JavaScript

Pure Functions

A function where the return value is only determined by

  • its input values

  • without observable side effects

Pure Functions (Slice vs. Splice)

Map, Filter & Reduce

Array helper methods map, filter and reduce are examples of functional programming, which take in functions and do not mutate the original array.

🙋🏾‍♂️ examples

Currying

A technique of converting a function that takes multiple arguments into a sequence of functions, each with a single argument.

Currying add

Currying add

Currying add With ES6

🙋🏾‍♂️ example

[fit] React

Journey to React

  • Direct DOM manipulation/jQuery

  • Templates

  • Template based frameworks such as AngularJS

jQuery

Templates

AngularJS

First Gen. SPA Frameworks

  • Renders the DOM using templates

  • Manages DOM updates when data changes

  • Manages event bindings (click, scroll, etc.)

[fit] How Is React Different?

[fit] views as pure

[fit] stateless functions

[fit] View(Data) ➡️ HTML

React

  • No templates

  • Define UI as components

    • connected to data

  • Re-renders the whole world when data changes

  • Manages event bindings

Hello, world!

[fit] JSX

JSX 🤷🏽‍♂️

JSX?

JSX

🙋🏾‍♂️ full example

Virtual DOM

original 150%

React Terminology

  • Virtual DOM ✅

  • JSX ✅

  • State

  • Props

  • Children

  • Stateless vs Stateful Components

  • Presentational vs Container Components

[fit] Components

Hello Component

Composition

right fit

Thinking in Components

Atomic Design Principles

We're not designing pages, we're designing systems of components -- – Stephen Hay

Atomic Design Principles

fit original

Atoms

  • Simplest building block

  • HTML tags

  • Easily styled

  • Highly reusable

  • Not very useful on their own

fit right

Molecules

fit right

Organisms

fit inline

Ecosystem

  • What the client will see

  • Connected containers

  • Many components that make up a view

right fit

Environment

  • Root Component

  • Typically the <App /> component

  • Represents everything packaged together as an application

left fit

Component Hierarchy

inline 400% original

Component Hierarchy

  • FilterableProductTable

  • SearchBar

  • ProductTable

  • ProductCategoryRow

  • ProductRow

right fit original

Quiz

Breakdown the Mockup

right fit

Task

Breakdown the Mockup

  • Header

  • Navigator

  • NavigatorLink

  • Content

  • ProfileCard

  • ProfileImage

right fit

Let's Code!

Card

right original 100%

<RobotCard><Card><Media><Heading><SubHeading>

Last updated

Was this helpful?