Slide 1

Slide 1 text

The Future of React Peter Piekarczyk

Slide 2

Slide 2 text

ReasonML The Future of React Peter Piekarczyk
 Co-founder, Draftbit

Slide 3

Slide 3 text

PIES • CARS • CHICKS

Slide 4

Slide 4 text

Peter Piekarczyk •Polish •Loves to Cycle •ReasonML Lover •Expo / React Native Lover •Loves Plants (@petersplantss) •Y Combinator Alumn •Co-Founder of Draftbit

Slide 5

Slide 5 text

Draftbit is a platform to help you build mobile apps visually

Slide 6

Slide 6 text

1. Scan QR Code 2. Drag Component 3. Export Code

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

Layers (Js) Frame (Yoga / Wasm / Reason) Config (JS / Reason) Live Preview / Code Gen (Reason) Navigator (Reason)

Slide 10

Slide 10 text

Early days at a startup are… hard

Slide 11

Slide 11 text

Draftbit needed to move faster to survive

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

We gave Reason a shot & never looked back

Slide 14

Slide 14 text

Draftbit Stack • React & ReasonML • Web Assembly • Expo • GraphQL & Apollo • Postgres

Slide 15

Slide 15 text

We used to start with Javascript

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

“Hey Peter…”

Slide 18

Slide 18 text

“I think I broke something…”

Slide 19

Slide 19 text

15 min & 10 console.log’s later…

Slide 20

Slide 20 text

Config.apiUrl
 vs.
 Config.apiURL

Slide 21

Slide 21 text

Life Before 2015 Backbone Angular RequireJS jQuery Bower Gulp MVC CoffeeScript

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Life After 2015 Flowtype Eslint Babel Typescript Redux Yarn Prettier React Immutable

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

What do you get when you take all that shit

Slide 26

Slide 26 text

& make it easy?

Slide 27

Slide 27 text

You get Reason

Slide 28

Slide 28 text

• Created by React creator • Familiar Javascript syntax • Battle-tested language • Friendly compiler

Slide 29

Slide 29 text

What language was React originally written in?

Slide 30

Slide 30 text

StandardML

Slide 31

Slide 31 text

What is Reason?

Slide 32

Slide 32 text

Javascript as a statically typed,

Slide 33

Slide 33 text

functional language, with a friendly compiler

Slide 34

Slide 34 text

& amazing developer productivity

Slide 35

Slide 35 text

If it compiles, it works

Slide 36

Slide 36 text

What is OCaml?

Slide 37

Slide 37 text

A functional programming language

Slide 38

Slide 38 text

With twenty years of type theory,

Slide 39

Slide 39 text

Powerful pattern matching, functions

Slide 40

Slide 40 text

& a robust ecosystem of packages (OPAM)

Slide 41

Slide 41 text

• Compiles >10x faster than Babel • Eliminates typical JS errors • Easy to use within your existing JS app • Compiled code is easy to debug

Slide 42

Slide 42 text

Fast AF Compile Times TypeScript Scala

Slide 43

Slide 43 text

CRA 3.0 REASON

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

What does a React component look like?

Slide 47

Slide 47 text

Desugars to JSX

Slide 48

Slide 48 text

Similar, but a little different, right?

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

All your jsx is typed

Slide 51

Slide 51 text

Why is this valuable?

Slide 52

Slide 52 text

Because uncertainty is the devil

Slide 53

Slide 53 text

We all know what uncertainty is already like …

Slide 54

Slide 54 text

Web Developer

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

Pipe First makes it easy to read composable functions

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

[1, 2, 3] is a List

Slide 61

Slide 61 text

Lists are immutable, homogeneous & fast AF

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

Belt is the standard library shipped with Reason

Slide 64

Slide 64 text

A built-in lodash just for Reason

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

Convert your immutable list into an array

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

Convert your array into a React element

Slide 69

Slide 69 text

*both Lists & Arrays are supported

Slide 70

Slide 70 text

Hooks are the future

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

Tuples are immutable, ordered & heterogeneous

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

Pattern matching is a switch statement on steroids

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

Why is Tick capitalized?

Slide 80

Slide 80 text

Tick is not a string, its a constructor

Slide 81

Slide 81 text

No content

Slide 82

Slide 82 text

Variants offer a powerful way of representing complex data

Slide 83

Slide 83 text

Variants allow you to express this OR that

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

Constructors can take arguments, too!

Slide 86

Slide 86 text

No content

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

genType generates bindings between Reason & JavaScript

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

genType supports Typescript & Flowtype

Slide 91

Slide 91 text

No content

Slide 92

Slide 92 text

Can I use my existing Javascript components in Reason?

Slide 93

Slide 93 text

No content

Slide 94

Slide 94 text

No content

Slide 95

Slide 95 text

That’ll be automated soon, too ☺

Slide 96

Slide 96 text

No content

Slide 97

Slide 97 text

How do I add Reason to my Javascript project?

Slide 98

Slide 98 text

1. yarn add bs-platform —dev 2. add bsconfig.json 3. add script tags

Slide 99

Slide 99 text

No content

Slide 100

Slide 100 text

ReasonML
 (.re, .rei) OCaml
 (.ml, .mli) OCaml AST Bytecode Native code JavaScript

Slide 101

Slide 101 text

BuckleScript

Slide 102

Slide 102 text

Write safer, simple, readable code that compiles to JavaScript

Slide 103

Slide 103 text

The compiled JavaScript is readable

Slide 104

Slide 104 text

No content

Slide 105

Slide 105 text

No content

Slide 106

Slide 106 text

No content

Slide 107

Slide 107 text

No content

Slide 108

Slide 108 text

The compiled JavaScript is faster

Slide 109

Slide 109 text

ImmutableJS Map 3415ms

Slide 110

Slide 110 text

Reason Immutable Map 1186ms

Slide 111

Slide 111 text

Tree Shaking is %

Slide 112

Slide 112 text

Webpack 55,000 Bytes

Slide 113

Slide 113 text

Bucklescript 899 Bytes

Slide 114

Slide 114 text

No content

Slide 115

Slide 115 text

BuckleScript has a deep integration with JS libs

Slide 116

Slide 116 text

Binding Javascript to Reason

Slide 117

Slide 117 text

No content

Slide 118

Slide 118 text

*Getting this right is the hardest part

Slide 119

Slide 119 text

There are bindings for almost every library

Slide 120

Slide 120 text

No content

Slide 121

Slide 121 text

Is Reason ready for production?

Slide 122

Slide 122 text

No content

Slide 123

Slide 123 text

Companies Shipping Reason

Slide 124

Slide 124 text

(& many more)

Slide 125

Slide 125 text

No content

Slide 126

Slide 126 text

Where can I learn more?

Slide 127

Slide 127 text

Chicago ReasonML Meetup

Slide 128

Slide 128 text

ReasonML Discord Google it

Slide 129

Slide 129 text

Reason Conf US Chicago • October 2019

Slide 130

Slide 130 text

Keynote by Jordan Walke Creator of React

Slide 131

Slide 131 text

www.reason-conf.us

Slide 132

Slide 132 text

No content

Slide 133

Slide 133 text

Don’t be that person

Slide 134

Slide 134 text

BAEs BEST. AUDIENCE. EVER. draftbit.com/reason draftbit • peterpme

Slide 135

Slide 135 text

No content