Slide 1

Slide 1 text

Immutable Data With Immer Using immutable data structures provides many benefits, including making your code easier to reason about and less prone to bugs.

Slide 2

Slide 2 text

HELLO Vitor Alencar @vitormalencar

Slide 3

Slide 3 text

Immutable State Structural sharing Currying Detect and distribute changes in data Today we’re looking at updates and new features regarding...

Slide 4

Slide 4 text

Functional Programming

Slide 5

Slide 5 text

Why Immutability is so important ?

Slide 6

Slide 6 text

Is deletable ?

Slide 7

Slide 7 text

Using immutable data structures provides many benefits, including making your code easier to reason about and less prone to bugs.

Slide 8

Slide 8 text

WHY ● Immutable objects are simpler to construct, test, and use ● Truly immutable objects are always thread-safe ● They help to avoid temporal coupling ● Their usage is side-effect free

Slide 9

Slide 9 text

Aug 4, 2014

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

nice but….

Slide 12

Slide 12 text

Immer

Slide 13

Slide 13 text

Keeps previous state, produces new next state

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

How does Immer work?

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

● Proxy root ● Lazily create proxy when a field is dereferenced ● Upon write, create shallow clone ● Upon finish, combine clones, freeze the modified objects

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Immutable State

Slide 25

Slide 25 text

Currying

Slide 26

Slide 26 text

Even Better

Slide 27

Slide 27 text

Hooks

Slide 28

Slide 28 text

Hooks

Slide 29

Slide 29 text

Performance

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

● Immutability with normal JavaScript objects, arrays, Sets and Maps. No new APIs to learn! ● Strongly typed, no string based paths selectors etc. ● Structural sharing out of the box ● Object freezing out of the box ● Deep updates are a breeze ● Boilerplate reduction. Less noise, more concise code. ● First class support for patches ● Small size 6kb Benefits

Slide 32

Slide 32 text

Obrigado!