SlideShare a Scribd company logo
1 of 90
Download to read offline
JavaScript developer
friendly syntax
let meaningOfLife = 41 + 1;
let add = (x, y) => x + y;
add(2, 2);
add(41, 1);
let fruits = ["Apple", "Orange"];
if (true) {
print_string("Hello World!");
};
OCaml semantics
Reason Syntax OCaml Syntax
OCaml AST
Records
let jane = {name: "Jane", age: 40};
let jane = {name: "Jane", age: 40};
type person = {
name: string,
age: int,
};
let jane = {name: "Jane", age: 40};
type person = {
name: string,
age: int,
};
let jane = {name: "Jane", age: 40};
let tim = {...jane, name: "Tim"};
Compiles to JavaScript
Reason Syntax OCaml Syntax
OCaml AST
JavaScript
BuckleScript
Reason Syntax OCaml Syntax
OCaml AST
Native Code JavaScript
BuckleScript
Formatter
Reason Syntax OCaml Syntax
OCaml AST
Native Code JavaScript
BuckleScript
Reason Syntax OCaml Syntax
OCaml AST
Native Code JavaScript
refmt
BuckleScript
Statically Typed Language
Why yet another one?
const pieces = [
{ kind: "king", color: "black", position: [3, 4] },
{ kind: "pawn", color: "black", position: [4, 2] },
{ kind: "knight", color: "white", position: [3, 3] }
];
JavaScript
interface Piece {
kind: string;
color: string;
position: number[];
}
const pieces = [
{ kind: "king", color: "black", position: [3, 4] },
{ kind: "pawn", color: "black", position: [4, 2] },
{ kind: "knight", color: "white", position: [3, 3] }
];
const getKinds = (pieces: Piece[]) => pieces.map(piece => piece.kind);
TypeScript
interface Piece {
kind: string;
color: string;
position: number[];
}
const pieces = [
{ kind: "king", color: "black", position: [3, 4] },
{ kind: "pawn", color: "black", position: [4, 2] },
{ kind: "knight", color: "white", position: [3, 3] }
];
const getKinds = (pieces: Piece[]) => pieces.map(piece => piece.kind);
TypeScript
type piece = {
kind: string,
color: string,
position: (int, int),
};
let pieces = [
{kind: "king", color: "black", position: (3, 4)},
{kind: "pawn", color: "black", position: (4, 2)},
{kind: "knight", color: "white", position: (3, 3)},
];
let getKinds = pieces => List.map(item => item.kind, pieces);
Reason
import * as React from "react";
interface Props {
text: string;
checked: boolean;
onToggle(): void;
}
export default TodoItem: React.SFC<Props> = ({ text, checked, onToggle }) => (
<li>
<b
onClick={onToggle}
style={{
textDecoration: checked ? "line-through" : "none"
}}
>
{text}
</b>
</li>
);
TypeScript
Reason
let component = ReasonReact.statelessComponent("Todo");
let make = (~text, ~checked, ~onToggle, _children) => {
...component,
render: _self =>
<li>
<b
onClick=onToggle
style=(
ReactDOMRe.Style.make(
~textDecoration=checked ? "line-through" : "none",
(),
)
)>
(ReasonReact.string(text))
</b>
</li>,
};
Variants
type direction =
| Up
| Down
| Left
| Right;
type direction =
| Up
| Down
| Left
| Right;
let move = Left;
type direction =
| Up(int)
| Down(int)
| Left(int)
| Right(int);
let move = Left(2);
type data = {names: list(string)};
type request =
| Loading
| Error(int)
| Success(data);
type color = Black | White;
type kind = Queen | King | Rook | Bishop | Knight | Pawn;
type piece = {
color,
kind,
position: (int, int),
};
let pieces = [
{kind: King, color: Black, position: (3, 4)},
{kind: Pawn, color: Black, position: (4, 2)},
{kind: Knight, color: White, position: (3, 3)},
];
type color = Black | White;
type kind = Queen | King | Rook | Bishop | Knight | Pawn;
type piece = {
color,
kind,
position: (int, int),
};
let pieces = [
{kind: King, color: Black, position: (3, 4)},
{kind: Pawn, color: Black, position: (4, 2)},
{kind: Knight, color: White, position: (3, 3)},
];
type color = Black | White;
type kind = Queen | King | Rook | Bishop | Knight | Pawn;
type piece = {
color,
kind,
position: (int, int),
};
let pieces = [
{kind: King, color: Black, position: (3, 4)},
{kind: Pawn, color: Black, position: (4, 2)},
{kind: Knight, color: White, position: (3, 3)},
];
Pattern Matching
switch (<value>) {
| <pattern1> => <case1>
| <pattern2> => <case2>
| ...
};
switch (1) {
| 0 => "off"
| 1 => "on"
| _ => "off"
};
let displayText =
switch (1) {
| 0 => "off"
| 1 => "on"
| _ => "off"
};
type data = {names: list(string)};
type request =
| Loading
| Error(int)
| Success(data);
let ui =
switch (Loading) {
| Loading => "Loading ..."
| Error(code) => "Something went wrong. Error: " ++ string_of_int(code)
| Success(data) => List.fold_left((a, b) => a ++ b, "Names:", data.names)
};
type data = {names: list(string)};
type request =
| Loading
| Error(int)
| Success(data);
let ui =
switch (Loading) {
| Loading => "Loading ..."
| Error(401) => "You aren’t authenticated."
| Error(code) => "Something went wrong. Error: " ++ string_of_int(code)
| Success(data) => List.fold_left((a, b) => a ++ b, "Names:", data.names)
};
type data = {names: list(string)};
type request =
| Loading
| Error(int)
| Success(data);
let ui =
switch (Loading) {
| Loading => "Loading ..."
| Error(401 | 402) => "You aren’t authenticated."
| Error(code) => "Something went wrong. Error: " ++ string_of_int(code)
| Success(data) => List.fold_left((a, b) => a ++ b, "Names:", data.names)
};
– Tony Hoare
“I call it my billion-dollar mistake …”
Lesson I
Don’t implement anything just
because it’s easy!
Lesson II
Null is BAD!
null; // doesn't exist!
Option
let foo = None;
let foo = Some(42);
let foo = Some([1, 2, 3]);
let foo = Some("Hello World!");
let foo = None;
let foo = Some(42);
let foo = Some([1, 2, 3]);
let foo = Some("Hello World!");
switch (foo) {
| None => "Sadly I don't know."
| Some(value) => "It's " ++ value
};
Functions
let add = (x, y) => x + y;
add(2, 2);
add(41, 1);
let name = (~firstName, ~lastName) => firstName ++ " " ++ lastName;
/* Jane Doe */
name(~firstName="Jane", ~lastName="Doe");
/* Jane Doe */
name(~lastName="Doe", ~firstName="Jane");
ReasonReact
Stateless Component
let component = ReasonReact.statelessComponent("Greeting");
let make = (_children) => {
...component,
render: _self => <h1>(ReasonReact.string("Hello"))</h1>,
};
ReactDOMRe.renderToElementWithId(<Greeting />, "root");
Greeting.re
App.re
Props
let component = ReasonReact.statelessComponent("Greeting");
let make = (~name, _children) => {
...component,
render: _self => <h1>(ReasonReact.string(“Hello " ++ name))</h1>,
};
ReactDOMRe.renderToElementWithId(<Greeting name="Helsinki" />, "root");
Greeting.re
App.re
Props
let component = ReasonReact.statelessComponent("Greeting");
let make = (~name, _children) => {
...component,
render: _self => <h1>(ReasonReact.string("Hello " ++ name))</h1>,
};
ReactDOMRe.renderToElementWithId(<Greeting name="Helsinki" />, "root");
Greeting.re
App.re
Props
let component = ReasonReact.statelessComponent("Greeting");
let make = (~name, _children) => {
...component,
render: _self => <h1>(ReasonReact.string("Hello " ++ name))</h1>,
};
ReactDOMRe.renderToElementWithId(<Greeting name="Helsinki" />, "root");
Greeting.re
App.re
type state = {count: int};
type state = {count: int};
type action =
| Add(int)
| Reset;
type state = {count: int};
type action =
| Add(int)
| Reset;
let s = ReasonReact.string;
type state = {count: int};
type action =
| Add(int)
| Reset;
let s = ReasonReact.string;
let component = ReasonReact.reducerComponent("Counter");
type state = {count: int};
type action =
| Add(int)
| Reset;
let s = ReasonReact.string;
let component = ReasonReact.reducerComponent("Counter");
let make = _children => {
...component,
initialState: () => {count: 0},
type state = {count: int};
type action =
| Add(int)
| Reset;
let s = ReasonReact.string;
let component = ReasonReact.reducerComponent("Counter");
let make = _children => {
...component,
initialState: () => {count: 0},
reducer: (action, state) =>
switch (action) {
| Add(value) => ReasonReact.Update({count: state.count + value})
| Reset => ReasonReact.Update({count: 0})
},
type state = {count: int};
type action =
| Add(int)
| Reset;
let s = ReasonReact.string;
let component = ReasonReact.reducerComponent("Counter");
let make = _children => {
...component,
initialState: () => {count: 0},
reducer: (action, state) =>
switch (action) {
| Add(value) => ReasonReact.Update({count: state.count + value})
| Reset => ReasonReact.Update({count: 0})
},
render: self =>
<div>
(s(string_of_int(self.state.count)))
let s = ReasonReact.string;
let component = ReasonReact.reducerComponent("Counter");
let make = _children => {
...component,
initialState: () => {count: 0},
reducer: (action, state) =>
switch (action) {
| Add(value) => ReasonReact.Update({count: state.count + value})
| Reset => ReasonReact.Update({count: 0})
},
render: self =>
<div>
(s(string_of_int(self.state.count)))
<button onClick=(_event => self.send(Add(1)))> (s(“Add")) </button>
<button onClick=(_event => self.send(Add(2)))> (s("Add 2")) </button>
<button onClick=(_event => self.send(Reset))> (s("Reset")) </button>
</div>,
};
Manage your State with GraphQL
Interop with JavaScript
BuckleScript allows us to write bindings
ReasonReact
- wrapJsForReason
- wrapReasonForJs
[@bs.module "rebass"] external jsArrow : ReasonReact.reactClass = "Arrow";
let make = (~direction: string, children) =>
ReasonReact.wrapJsForReason(
~reactClass=jsArrow,
~props={"direction": direction},
children,
);
<Arrow direction="down" />
<Arrow direction="left" />
<Arrow direction="notRight"/>
Variants to the rescue!
[@bs.module "rebass"] external jsArrow : ReasonReact.reactClass = "Arrow";
type direction =
| Up
| Down;
let make = (~direction, children) => {
let directionString =
switch (direction) {
| Up => "up"
| Down => "down"
};
ReasonReact.wrapJsForReason(
~reactClass=jsArrow,
~props={"direction": directionString},
children,
);
};
<Arrow direction=Arrow.Down />;
<Arrow direction=Arrow.Left />;
<Arrow direction=Arrow.Left />;
So what now?
Don’t be that person
Time
Innovation
React Ecosystem
Time
Innovation
React Ecosystem
Reason Ecosystem
The End

More Related Content

What's hot

Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Jonas Bonér
 
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...PROIDEA
 
Swift에서 꼬리재귀 사용기 (Tail Recursion)
Swift에서 꼬리재귀 사용기 (Tail Recursion)Swift에서 꼬리재귀 사용기 (Tail Recursion)
Swift에서 꼬리재귀 사용기 (Tail Recursion)진성 오
 
Metaprogramming in Haskell
Metaprogramming in HaskellMetaprogramming in Haskell
Metaprogramming in HaskellHiromi Ishii
 
The underestimated power of KeyPaths
The underestimated power of KeyPathsThe underestimated power of KeyPaths
The underestimated power of KeyPathsVincent Pradeilles
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to SwiftGiordano Scalzo
 
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
From java to kotlin beyond alt+shift+cmd+k - Droidcon italyFrom java to kotlin beyond alt+shift+cmd+k - Droidcon italy
From java to kotlin beyond alt+shift+cmd+k - Droidcon italyFabio Collini
 
Swift 함수 커링 사용하기
Swift 함수 커링 사용하기Swift 함수 커링 사용하기
Swift 함수 커링 사용하기진성 오
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to PythonUC San Diego
 
Be Smart, Constrain Your Types to Free Your Brain!
Be Smart, Constrain Your Types to Free Your Brain!Be Smart, Constrain Your Types to Free Your Brain!
Be Smart, Constrain Your Types to Free Your Brain!Jorge Vásquez
 
From java to kotlin beyond alt+shift+cmd+k
From java to kotlin beyond alt+shift+cmd+kFrom java to kotlin beyond alt+shift+cmd+k
From java to kotlin beyond alt+shift+cmd+kFabio Collini
 
ZIO Prelude - ZIO World 2021
ZIO Prelude - ZIO World 2021ZIO Prelude - ZIO World 2021
ZIO Prelude - ZIO World 2021Jorge Vásquez
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)riue
 
つくってあそぼ Kotlin DSL ~拡張編~
つくってあそぼ Kotlin DSL ~拡張編~つくってあそぼ Kotlin DSL ~拡張編~
つくってあそぼ Kotlin DSL ~拡張編~kamedon39
 
つくってあそぼ Kotlin DSL 第2版
つくってあそぼ Kotlin DSL 第2版つくってあそぼ Kotlin DSL 第2版
つくってあそぼ Kotlin DSL 第2版kamedon39
 

What's hot (18)

Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)Pragmatic Real-World Scala (short version)
Pragmatic Real-World Scala (short version)
 
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...
 
Swift에서 꼬리재귀 사용기 (Tail Recursion)
Swift에서 꼬리재귀 사용기 (Tail Recursion)Swift에서 꼬리재귀 사용기 (Tail Recursion)
Swift에서 꼬리재귀 사용기 (Tail Recursion)
 
Metaprogramming in Haskell
Metaprogramming in HaskellMetaprogramming in Haskell
Metaprogramming in Haskell
 
The underestimated power of KeyPaths
The underestimated power of KeyPathsThe underestimated power of KeyPaths
The underestimated power of KeyPaths
 
Hammurabi
HammurabiHammurabi
Hammurabi
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to Swift
 
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
From java to kotlin beyond alt+shift+cmd+k - Droidcon italyFrom java to kotlin beyond alt+shift+cmd+k - Droidcon italy
From java to kotlin beyond alt+shift+cmd+k - Droidcon italy
 
Swift 함수 커링 사용하기
Swift 함수 커링 사용하기Swift 함수 커링 사용하기
Swift 함수 커링 사용하기
 
A tour of Python
A tour of PythonA tour of Python
A tour of Python
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Be Smart, Constrain Your Types to Free Your Brain!
Be Smart, Constrain Your Types to Free Your Brain!Be Smart, Constrain Your Types to Free Your Brain!
Be Smart, Constrain Your Types to Free Your Brain!
 
From java to kotlin beyond alt+shift+cmd+k
From java to kotlin beyond alt+shift+cmd+kFrom java to kotlin beyond alt+shift+cmd+k
From java to kotlin beyond alt+shift+cmd+k
 
ZIO Prelude - ZIO World 2021
ZIO Prelude - ZIO World 2021ZIO Prelude - ZIO World 2021
ZIO Prelude - ZIO World 2021
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)
 
つくってあそぼ Kotlin DSL ~拡張編~
つくってあそぼ Kotlin DSL ~拡張編~つくってあそぼ Kotlin DSL ~拡張編~
つくってあそぼ Kotlin DSL ~拡張編~
 
Developing iOS apps with Swift
Developing iOS apps with SwiftDeveloping iOS apps with Swift
Developing iOS apps with Swift
 
つくってあそぼ Kotlin DSL 第2版
つくってあそぼ Kotlin DSL 第2版つくってあそぼ Kotlin DSL 第2版
つくってあそぼ Kotlin DSL 第2版
 

Similar to Nik Graf - Get started with Reason and ReasonReact

Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?Adam Dudczak
 
여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala LanguageAshal aka JOKER
 
Tips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET ApplicationTips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET ApplicationJoni
 
Reason - introduction to language and its ecosystem | Łukasz Strączyński
Reason - introduction to language and its ecosystem | Łukasz StrączyńskiReason - introduction to language and its ecosystem | Łukasz Strączyński
Reason - introduction to language and its ecosystem | Łukasz StrączyńskiGrand Parade Poland
 
C++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfC++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfRahul04August
 
Hitchhiker's Guide to Functional Programming
Hitchhiker's Guide to Functional ProgrammingHitchhiker's Guide to Functional Programming
Hitchhiker's Guide to Functional ProgrammingSergey Shishkin
 
Scala - fra newbie til ninja på en time
Scala - fra newbie til ninja på en timeScala - fra newbie til ninja på en time
Scala - fra newbie til ninja på en timekarianneberg
 
Pragmatic Real-World Scala
Pragmatic Real-World ScalaPragmatic Real-World Scala
Pragmatic Real-World Scalaparag978978
 
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기Suyeol Jeon
 
A Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOA Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOJorge Vásquez
 
Beginning Scala Svcc 2009
Beginning Scala Svcc 2009Beginning Scala Svcc 2009
Beginning Scala Svcc 2009David Pollak
 

Similar to Nik Graf - Get started with Reason and ReasonReact (20)

Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
 
여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
JavaScript @ CTK
JavaScript @ CTKJavaScript @ CTK
JavaScript @ CTK
 
Elm: give it a try
Elm: give it a tryElm: give it a try
Elm: give it a try
 
Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
Tips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET ApplicationTips and Tricks of Developing .NET Application
Tips and Tricks of Developing .NET Application
 
Pooya Khaloo Presentation on IWMC 2015
Pooya Khaloo Presentation on IWMC 2015Pooya Khaloo Presentation on IWMC 2015
Pooya Khaloo Presentation on IWMC 2015
 
SDC - Einführung in Scala
SDC - Einführung in ScalaSDC - Einführung in Scala
SDC - Einführung in Scala
 
Reason - introduction to language and its ecosystem | Łukasz Strączyński
Reason - introduction to language and its ecosystem | Łukasz StrączyńskiReason - introduction to language and its ecosystem | Łukasz Strączyński
Reason - introduction to language and its ecosystem | Łukasz Strączyński
 
PureScript & Pux
PureScript & PuxPureScript & Pux
PureScript & Pux
 
C++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfC++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdf
 
Hitchhiker's Guide to Functional Programming
Hitchhiker's Guide to Functional ProgrammingHitchhiker's Guide to Functional Programming
Hitchhiker's Guide to Functional Programming
 
Scala - fra newbie til ninja på en time
Scala - fra newbie til ninja på en timeScala - fra newbie til ninja på en time
Scala - fra newbie til ninja på en time
 
Pragmatic Real-World Scala
Pragmatic Real-World ScalaPragmatic Real-World Scala
Pragmatic Real-World Scala
 
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
 
Miracle of std lib
Miracle of std libMiracle of std lib
Miracle of std lib
 
A Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOA Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIO
 
Beginning Scala Svcc 2009
Beginning Scala Svcc 2009Beginning Scala Svcc 2009
Beginning Scala Svcc 2009
 
A bit about Scala
A bit about ScalaA bit about Scala
A bit about Scala
 

More from OdessaJS Conf

'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021OdessaJS Conf
 
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021OdessaJS Conf
 
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021OdessaJS Conf
 
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...OdessaJS Conf
 
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021OdessaJS Conf
 
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...OdessaJS Conf
 
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...OdessaJS Conf
 
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021OdessaJS Conf
 
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні..."NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...OdessaJS Conf
 
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
'BUILDING ANGULAR APPS WITH NX' by Anastasia NecheporenkoOdessaJS Conf
 
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by Dmytro Gusev
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by  Dmytro Gusev'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by  Dmytro Gusev
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by Dmytro GusevOdessaJS Conf
 
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav DvorovenkoOdessaJS Conf
 
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...OdessaJS Conf
 
'MICROFRONTENDS WITH REACT' by Liliia Karpenko
 'MICROFRONTENDS WITH REACT' by Liliia Karpenko 'MICROFRONTENDS WITH REACT' by Liliia Karpenko
'MICROFRONTENDS WITH REACT' by Liliia KarpenkoOdessaJS Conf
 
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020OdessaJS Conf
 
'STORY OF ANOTHER ANIMATION' by YURII ARTYUKH at OdessaJS'2020
'STORY OF ANOTHER ANIMATION' by  YURII ARTYUKH at OdessaJS'2020'STORY OF ANOTHER ANIMATION' by  YURII ARTYUKH at OdessaJS'2020
'STORY OF ANOTHER ANIMATION' by YURII ARTYUKH at OdessaJS'2020OdessaJS Conf
 
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020OdessaJS Conf
 
'Why svelte' by BORYS MOHYLA at OdessaJS'2020
'Why svelte' by BORYS MOHYLA at OdessaJS'2020'Why svelte' by BORYS MOHYLA at OdessaJS'2020
'Why svelte' by BORYS MOHYLA at OdessaJS'2020OdessaJS Conf
 
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020OdessaJS Conf
 
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020OdessaJS Conf
 

More from OdessaJS Conf (20)

'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
 
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
 
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
 
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
 
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
 
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
 
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
 
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
 
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні..."NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
 
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
 
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by Dmytro Gusev
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by  Dmytro Gusev'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by  Dmytro Gusev
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by Dmytro Gusev
 
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
 
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
 
'MICROFRONTENDS WITH REACT' by Liliia Karpenko
 'MICROFRONTENDS WITH REACT' by Liliia Karpenko 'MICROFRONTENDS WITH REACT' by Liliia Karpenko
'MICROFRONTENDS WITH REACT' by Liliia Karpenko
 
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
 
'STORY OF ANOTHER ANIMATION' by YURII ARTYUKH at OdessaJS'2020
'STORY OF ANOTHER ANIMATION' by  YURII ARTYUKH at OdessaJS'2020'STORY OF ANOTHER ANIMATION' by  YURII ARTYUKH at OdessaJS'2020
'STORY OF ANOTHER ANIMATION' by YURII ARTYUKH at OdessaJS'2020
 
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
 
'Why svelte' by BORYS MOHYLA at OdessaJS'2020
'Why svelte' by BORYS MOHYLA at OdessaJS'2020'Why svelte' by BORYS MOHYLA at OdessaJS'2020
'Why svelte' by BORYS MOHYLA at OdessaJS'2020
 
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
 
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
 

Recently uploaded

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

Nik Graf - Get started with Reason and ReasonReact

  • 1.
  • 2.
  • 5. let add = (x, y) => x + y; add(2, 2); add(41, 1);
  • 6. let fruits = ["Apple", "Orange"];
  • 9. Reason Syntax OCaml Syntax OCaml AST
  • 11. let jane = {name: "Jane", age: 40};
  • 12. let jane = {name: "Jane", age: 40};
  • 13. type person = { name: string, age: int, }; let jane = {name: "Jane", age: 40};
  • 14. type person = { name: string, age: int, }; let jane = {name: "Jane", age: 40}; let tim = {...jane, name: "Tim"};
  • 16. Reason Syntax OCaml Syntax OCaml AST JavaScript BuckleScript
  • 17. Reason Syntax OCaml Syntax OCaml AST Native Code JavaScript BuckleScript
  • 19. Reason Syntax OCaml Syntax OCaml AST Native Code JavaScript BuckleScript
  • 20. Reason Syntax OCaml Syntax OCaml AST Native Code JavaScript refmt BuckleScript
  • 22.
  • 24. const pieces = [ { kind: "king", color: "black", position: [3, 4] }, { kind: "pawn", color: "black", position: [4, 2] }, { kind: "knight", color: "white", position: [3, 3] } ]; JavaScript
  • 25. interface Piece { kind: string; color: string; position: number[]; } const pieces = [ { kind: "king", color: "black", position: [3, 4] }, { kind: "pawn", color: "black", position: [4, 2] }, { kind: "knight", color: "white", position: [3, 3] } ]; const getKinds = (pieces: Piece[]) => pieces.map(piece => piece.kind); TypeScript
  • 26. interface Piece { kind: string; color: string; position: number[]; } const pieces = [ { kind: "king", color: "black", position: [3, 4] }, { kind: "pawn", color: "black", position: [4, 2] }, { kind: "knight", color: "white", position: [3, 3] } ]; const getKinds = (pieces: Piece[]) => pieces.map(piece => piece.kind); TypeScript
  • 27. type piece = { kind: string, color: string, position: (int, int), }; let pieces = [ {kind: "king", color: "black", position: (3, 4)}, {kind: "pawn", color: "black", position: (4, 2)}, {kind: "knight", color: "white", position: (3, 3)}, ]; let getKinds = pieces => List.map(item => item.kind, pieces); Reason
  • 28. import * as React from "react"; interface Props { text: string; checked: boolean; onToggle(): void; } export default TodoItem: React.SFC<Props> = ({ text, checked, onToggle }) => ( <li> <b onClick={onToggle} style={{ textDecoration: checked ? "line-through" : "none" }} > {text} </b> </li> ); TypeScript
  • 29. Reason let component = ReasonReact.statelessComponent("Todo"); let make = (~text, ~checked, ~onToggle, _children) => { ...component, render: _self => <li> <b onClick=onToggle style=( ReactDOMRe.Style.make( ~textDecoration=checked ? "line-through" : "none", (), ) )> (ReasonReact.string(text)) </b> </li>, };
  • 31. type direction = | Up | Down | Left | Right;
  • 32. type direction = | Up | Down | Left | Right; let move = Left;
  • 33. type direction = | Up(int) | Down(int) | Left(int) | Right(int); let move = Left(2);
  • 34. type data = {names: list(string)}; type request = | Loading | Error(int) | Success(data);
  • 35. type color = Black | White; type kind = Queen | King | Rook | Bishop | Knight | Pawn; type piece = { color, kind, position: (int, int), }; let pieces = [ {kind: King, color: Black, position: (3, 4)}, {kind: Pawn, color: Black, position: (4, 2)}, {kind: Knight, color: White, position: (3, 3)}, ];
  • 36. type color = Black | White; type kind = Queen | King | Rook | Bishop | Knight | Pawn; type piece = { color, kind, position: (int, int), }; let pieces = [ {kind: King, color: Black, position: (3, 4)}, {kind: Pawn, color: Black, position: (4, 2)}, {kind: Knight, color: White, position: (3, 3)}, ];
  • 37. type color = Black | White; type kind = Queen | King | Rook | Bishop | Knight | Pawn; type piece = { color, kind, position: (int, int), }; let pieces = [ {kind: King, color: Black, position: (3, 4)}, {kind: Pawn, color: Black, position: (4, 2)}, {kind: Knight, color: White, position: (3, 3)}, ];
  • 39. switch (<value>) { | <pattern1> => <case1> | <pattern2> => <case2> | ... };
  • 40. switch (1) { | 0 => "off" | 1 => "on" | _ => "off" };
  • 41. let displayText = switch (1) { | 0 => "off" | 1 => "on" | _ => "off" };
  • 42. type data = {names: list(string)}; type request = | Loading | Error(int) | Success(data); let ui = switch (Loading) { | Loading => "Loading ..." | Error(code) => "Something went wrong. Error: " ++ string_of_int(code) | Success(data) => List.fold_left((a, b) => a ++ b, "Names:", data.names) };
  • 43. type data = {names: list(string)}; type request = | Loading | Error(int) | Success(data); let ui = switch (Loading) { | Loading => "Loading ..." | Error(401) => "You aren’t authenticated." | Error(code) => "Something went wrong. Error: " ++ string_of_int(code) | Success(data) => List.fold_left((a, b) => a ++ b, "Names:", data.names) };
  • 44. type data = {names: list(string)}; type request = | Loading | Error(int) | Success(data); let ui = switch (Loading) { | Loading => "Loading ..." | Error(401 | 402) => "You aren’t authenticated." | Error(code) => "Something went wrong. Error: " ++ string_of_int(code) | Success(data) => List.fold_left((a, b) => a ++ b, "Names:", data.names) };
  • 45.
  • 46. – Tony Hoare “I call it my billion-dollar mistake …”
  • 47.
  • 48.
  • 49. Lesson I Don’t implement anything just because it’s easy!
  • 53. let foo = None; let foo = Some(42); let foo = Some([1, 2, 3]); let foo = Some("Hello World!");
  • 54. let foo = None; let foo = Some(42); let foo = Some([1, 2, 3]); let foo = Some("Hello World!"); switch (foo) { | None => "Sadly I don't know." | Some(value) => "It's " ++ value };
  • 56. let add = (x, y) => x + y; add(2, 2); add(41, 1);
  • 57. let name = (~firstName, ~lastName) => firstName ++ " " ++ lastName; /* Jane Doe */ name(~firstName="Jane", ~lastName="Doe"); /* Jane Doe */ name(~lastName="Doe", ~firstName="Jane");
  • 59. Stateless Component let component = ReasonReact.statelessComponent("Greeting"); let make = (_children) => { ...component, render: _self => <h1>(ReasonReact.string("Hello"))</h1>, }; ReactDOMRe.renderToElementWithId(<Greeting />, "root"); Greeting.re App.re
  • 60. Props let component = ReasonReact.statelessComponent("Greeting"); let make = (~name, _children) => { ...component, render: _self => <h1>(ReasonReact.string(“Hello " ++ name))</h1>, }; ReactDOMRe.renderToElementWithId(<Greeting name="Helsinki" />, "root"); Greeting.re App.re
  • 61. Props let component = ReasonReact.statelessComponent("Greeting"); let make = (~name, _children) => { ...component, render: _self => <h1>(ReasonReact.string("Hello " ++ name))</h1>, }; ReactDOMRe.renderToElementWithId(<Greeting name="Helsinki" />, "root"); Greeting.re App.re
  • 62. Props let component = ReasonReact.statelessComponent("Greeting"); let make = (~name, _children) => { ...component, render: _self => <h1>(ReasonReact.string("Hello " ++ name))</h1>, }; ReactDOMRe.renderToElementWithId(<Greeting name="Helsinki" />, "root"); Greeting.re App.re
  • 63.
  • 64. type state = {count: int};
  • 65. type state = {count: int}; type action = | Add(int) | Reset;
  • 66. type state = {count: int}; type action = | Add(int) | Reset; let s = ReasonReact.string;
  • 67. type state = {count: int}; type action = | Add(int) | Reset; let s = ReasonReact.string; let component = ReasonReact.reducerComponent("Counter");
  • 68. type state = {count: int}; type action = | Add(int) | Reset; let s = ReasonReact.string; let component = ReasonReact.reducerComponent("Counter"); let make = _children => { ...component, initialState: () => {count: 0},
  • 69. type state = {count: int}; type action = | Add(int) | Reset; let s = ReasonReact.string; let component = ReasonReact.reducerComponent("Counter"); let make = _children => { ...component, initialState: () => {count: 0}, reducer: (action, state) => switch (action) { | Add(value) => ReasonReact.Update({count: state.count + value}) | Reset => ReasonReact.Update({count: 0}) },
  • 70. type state = {count: int}; type action = | Add(int) | Reset; let s = ReasonReact.string; let component = ReasonReact.reducerComponent("Counter"); let make = _children => { ...component, initialState: () => {count: 0}, reducer: (action, state) => switch (action) { | Add(value) => ReasonReact.Update({count: state.count + value}) | Reset => ReasonReact.Update({count: 0}) }, render: self => <div> (s(string_of_int(self.state.count)))
  • 71. let s = ReasonReact.string; let component = ReasonReact.reducerComponent("Counter"); let make = _children => { ...component, initialState: () => {count: 0}, reducer: (action, state) => switch (action) { | Add(value) => ReasonReact.Update({count: state.count + value}) | Reset => ReasonReact.Update({count: 0}) }, render: self => <div> (s(string_of_int(self.state.count))) <button onClick=(_event => self.send(Add(1)))> (s(“Add")) </button> <button onClick=(_event => self.send(Add(2)))> (s("Add 2")) </button> <button onClick=(_event => self.send(Reset))> (s("Reset")) </button> </div>, };
  • 72.
  • 73. Manage your State with GraphQL
  • 75. BuckleScript allows us to write bindings ReasonReact - wrapJsForReason - wrapReasonForJs
  • 76. [@bs.module "rebass"] external jsArrow : ReasonReact.reactClass = "Arrow"; let make = (~direction: string, children) => ReasonReact.wrapJsForReason( ~reactClass=jsArrow, ~props={"direction": direction}, children, );
  • 80.
  • 81. Variants to the rescue!
  • 82. [@bs.module "rebass"] external jsArrow : ReasonReact.reactClass = "Arrow"; type direction = | Up | Down; let make = (~direction, children) => { let directionString = switch (direction) { | Up => "up" | Down => "down" }; ReasonReact.wrapJsForReason( ~reactClass=jsArrow, ~props={"direction": directionString}, children, ); };
  • 87. Don’t be that person