react london april- fully functional: central state is a great fit for react , viktor charypar and...
TRANSCRIPT
ExampleMessages
{ selectedConversation: 0, conversations: [ { title: "..." messages: [ { user: {...} text: "..." }, {...} ] }, {...}, ... ] }
T
2 3 4
A B C
X Y
1
42
Solution: a cursorc1 = cursor(T) c2 = c1.get(3) c3 = c2.get(A) v3 = c3.deref() # => “A” c3.update(“42”) c4 = c2.get(A) v4 = c4.deref() # => “42” v3 # => “A”
Cursor• Reference into a data structure
• Lightweight: reference + path
• Dereferencing gives local copy
• Updates replace entire backing data
• Persistent data structures make it efficient
Central state• Advanced features: Persistence, Undo / Redo
• Isomorphism
• Easy testing and debugging
• Simplicity
Things you want• Immutable modular observable central state
• Routing, Isomorphism
• Quick and easy setup
• Toys: CLI, generators, server, hot-loading, …
to build a React application
Arch• Full application framework for React
• Observable cursor implementation
• LiveScript
• Client-first: Routing, Isomorphic rendering, Isomorphic form processing alpha
• CLI, Node.js server, Webpack bundler (incl. component hot loading)
Arch 0.1
• Used internally at Red Badger
• All feedback welcome
github.com/redbadger/arch