DataArt. Retrospective презентация

Слайд 2

React Roman Enikeev Development Lead

React

Roman Enikeev
Development Lead

Слайд 3

Retrospective

Retrospective

Слайд 4

State of JS

State of JS

Слайд 5

State of Frameworks

State of Frameworks

Слайд 6

ReactJS pros

ReactJS pros

Слайд 7

ReactJS cons

ReactJS cons

Слайд 8

What is React

What is React

Слайд 9

What is Virtual DOM?

What is Virtual DOM?

Слайд 10

Props: Passed in from parent this.props read-only within Can be

Props:
Passed in from parent

this.props read-only within
Can be defaulted and

validated
props get passed to the component similar to function parameters
State:
Created within component
getInitialState
this.state to read
this.setState() to update
state is managed within the component similar to variables declared within a function.

State vs Props

Слайд 11

Component lifecycle

Component lifecycle

Слайд 12

Component lifecycle

Component lifecycle

Слайд 13

How React works?

How React works?

Слайд 14

What is JSX?

What is JSX?

Слайд 15

What are controlled components?

What are controlled components?

Слайд 16

What is Flux?

What is Flux?

Слайд 17

High Order Components

High Order Components

Слайд 18

A pure function is a function which: Given the same

A pure function is a function which:
Given the same input, will

always return the same output
Produces no side effects
Relies on no external state
To make a copy of the input object using the {…} spread operator or Object.assign() and make changes to the new object, leaving the original unchanged.
This concept is fundamental to the central “state” model used in React and Redux, where state is an object containing the single source for your whole application.

Pure functions

Слайд 19

What is Redux? Redux is a predictable state container for JavaScript apps.

What is Redux?

Redux is a predictable state container for JavaScript apps.

Слайд 20

How is state changed in Redux?

How is state changed in Redux?

Слайд 21

The application has a central / root state. A state

The application has a central / root state.
A state change triggers View updates.
Only

special functions can change the state.
A user interaction triggers these special, state changing functions.
Only one change takes place at a time.

Uni-Directional Architecture

Слайд 22

Redux is Flux – Wrong! Redux is ONLY for React

Redux is Flux – Wrong!
Redux is ONLY for React – Wrong!
Redux

Makes Your Application Faster – Wrong!

Redux – Confusions and Myths

Слайд 23

Single Source of Truth The state of your whole application

Single Source of Truth
The state of your whole application is stored

in an object tree within a single store.
State is Read Only
The only way to change the state is to emit an action, an object describing what happened.
Views cannot change the state DIRECTLY!
Use Pure Functions for Changes
To specify how the state tree is transformed by actions, you write pure reducers.

Principles of Redux

Слайд 24

Store Action Reducers Three Pillars of Redux

Store
Action
Reducers

Three Pillars of Redux

Слайд 25

getState: dispatch: subscribe: unsubscribe: Store

getState:
dispatch:
subscribe:
unsubscribe:

Store

Слайд 26

Note: Redux does not have explicit rules for how you

Note: Redux does not have explicit rules for how you should

structure actions. In fact, Redux doesn’t have any strict rules other than the three principles.
Redux recommends that you give each action a type and that’s a good idea. I also recommend using payload to store any more information related to the action. This keeps everything consistent.

Action

Слайд 27

Reducers are the pure functions. They know what to do

Reducers are the pure functions. They know what to do with

an action and its information (payload).
They take in the current state and an action and return a new state.
Unlike Flux, Redux has a single store. Your entire applications state is in one object. That means using a single reducer function is not practical. We’d end up with a 1000-line file that nobody would want to read.

Reducers

Слайд 28

How is state changed in Redux?

How is state changed in Redux?

Слайд 29

Demo app

Demo app

Слайд 30

Setup

Setup

Слайд 31

Utility Functions

Utility Functions

Слайд 32

Action Creators

Action Creators

Слайд 33

Hook Behavior

Hook Behavior

Слайд 34

Finally

Finally

Имя файла: DataArt.-Retrospective.pptx
Количество просмотров: 69
Количество скачиваний: 0