getting started with datascript and reagent

30
Getting started with Datascript & Reagent for webapps Brice Fernandes @fractallambda [email protected] tiny.cc/reactive-datascript

Upload: fractallambda

Post on 02-Jul-2015

1.273 views

Category:

Software


0 download

DESCRIPTION

Quick introduction on how to use Datascript with Reagent to build web applications. Given to the Cambridge NonDysFunctional Programmers Meetup on November 13th 2014.

TRANSCRIPT

Page 1: Getting Started With Datascript and Reagent

Getting started with

Datascript & Reagent for webapps

Brice Fernandes@fractallambda

[email protected]

tiny.cc/reactive-datascript

Page 2: Getting Started With Datascript and Reagent

DataScript: Datomic-like queries on Clojurescript browser objects

Reagent: Clojurescript wrapper around Facebook’s React.js reactive UI library

Page 3: Getting Started With Datascript and Reagent

HintsUse lein  cljsbuild  auto to rebuild whenever your files are modified

Create a new tabset in LightTable: ^-space then search for Tabset: Add a tablet

Create a browser tab in LightTable: ^-space then search for Browser: Add browser tab

Page 4: Getting Started With Datascript and Reagent

Rendering to the page1

Reagent Atoms are special2

Enter Datascript3

Binding Datascript & Reagent4

Fun with Datascript5

Page 5: Getting Started With Datascript and Reagent
Page 6: Getting Started With Datascript and Reagent

Your turn.

Make a basic profile page for a dog

Page 7: Getting Started With Datascript and Reagent

Rendering to the page1

Reagent Atoms are special2

Enter Datascript3

Binding Datascript & Reagent4

Fun with Datascript5

Page 8: Getting Started With Datascript and Reagent
Page 9: Getting Started With Datascript and Reagent

Your turn.

Let a dog change mood by clicking a button

Page 10: Getting Started With Datascript and Reagent

Rendering to the page1

Reagent Atoms are special2

Enter Datascript3

Binding Datascript & Reagent4

Fun with Datascript5

Page 11: Getting Started With Datascript and Reagent

Page 12: Getting Started With Datascript and Reagent

Listing all dogs

Page 13: Getting Started With Datascript and Reagent

Page 14: Getting Started With Datascript and Reagent

Dog Match-Making

Page 15: Getting Started With Datascript and Reagent
Page 16: Getting Started With Datascript and Reagent

Page 17: Getting Started With Datascript and Reagent

Your turn.

Match male dogs of similar age (~1 year) into packs and list possible packs

Page 18: Getting Started With Datascript and Reagent

Datomic Query Docs: http://docs.datomic.com/query.html

Datascript Test Examples: http://tiny.cc/datascript-test

Datalog/Datascript Tutorial: http://www.learndatalogtoday.org/

Page 19: Getting Started With Datascript and Reagent

! What Happens when you change the DB?

Page 20: Getting Started With Datascript and Reagent

Page 21: Getting Started With Datascript and Reagent

:(Nothing…

Page 22: Getting Started With Datascript and Reagent

Rendering to the page1

Reagent Atoms are special2

Enter Datascript3

Binding Datascript & Reagent4

More Fun with Datascript5

Page 23: Getting Started With Datascript and Reagent
Page 24: Getting Started With Datascript and Reagent
Page 25: Getting Started With Datascript and Reagent

Page 26: Getting Started With Datascript and Reagent

1

2

Page 27: Getting Started With Datascript and Reagent

Your turn.

Update 1) The members count 2) The pairings

Page 28: Getting Started With Datascript and Reagent

Rendering to the page1

Reagent Atoms are special2

Enter Datascript3

Binding Datascript & Reagent4

Fun with Datascript5

Page 29: Getting Started With Datascript and Reagent

Your turn.

Add to the app :-)

Suggest looking at one:many relations (parents / child)

Page 30: Getting Started With Datascript and Reagent

Brice Fernandes@fractallambda

[email protected]

tiny.cc/reactive-datascript?Bind and Unbind Function from https://gist.github.com/allgress/11348685