All Projects → carocad → rata

carocad / rata

Licence: LGPL-3.0 license
State management through Datascript and Reagent

Programming Languages

clojure
4091 projects
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to rata

React Atom
A simple way manage state in React, inspired by Clojure(Script) and reagent.cljs
Stars: ✭ 133 (+216.67%)
Mutual labels:  state-management, reagent
statery
Surprise-Free State Management! Designed for React with functional components, but can also be used with other frameworks (or no framework at all.)
Stars: ✭ 28 (-33.33%)
Mutual labels:  state-management
statebot-sh
Statebot for shell-scripts. Write more robust and understandable programs.
Stars: ✭ 14 (-66.67%)
Mutual labels:  state-management
nextjs-layout-state
PoC on how to omit state from different pages in a Next.js application
Stars: ✭ 25 (-40.48%)
Mutual labels:  state-management
getx snippets extension
An extension to accelerate the process of developing applications with flutter, aimed at everyone using the GetX package.
Stars: ✭ 142 (+238.1%)
Mutual labels:  state-management
vuex-but-for-react
A state management library for React, heavily inspired by vuex
Stars: ✭ 96 (+128.57%)
Mutual labels:  state-management
ReduRx
👌 A thin layer of a Redux-based state manager on top of RxDart
Stars: ✭ 41 (-2.38%)
Mutual labels:  state-management
particule
Fine-grained atomic React state management library
Stars: ✭ 31 (-26.19%)
Mutual labels:  state-management
urx
urx is a stream-based Reactive state management library
Stars: ✭ 18 (-57.14%)
Mutual labels:  state-management
double-bundle
Example for integrating React NPM dependencies with Clojurescript
Stars: ✭ 23 (-45.24%)
Mutual labels:  reagent
riduce
Get rid of your reducer boilerplate! Zero hassle state management that's typed, flexible and scalable.
Stars: ✭ 14 (-66.67%)
Mutual labels:  state-management
whatsup
Reactive framework, simple, fast, easy to use!
Stars: ✭ 115 (+173.81%)
Mutual labels:  state-management
angular-workshop
Learning Angular: From component state to NgRx
Stars: ✭ 40 (-4.76%)
Mutual labels:  state-management
ReduxSwift
Predictable state container for Swift too
Stars: ✭ 38 (-9.52%)
Mutual labels:  state-management
fs2-es
Event sourcing utilities for FS2
Stars: ✭ 75 (+78.57%)
Mutual labels:  state-management
flutter expense manager
Flutter Provider and Shared Preferences Sample Application.
Stars: ✭ 59 (+40.48%)
Mutual labels:  state-management
bounce
The uncomplicated Yew State management library
Stars: ✭ 43 (+2.38%)
Mutual labels:  state-management
wedi
[Deprecated] A lightweight dependency injection (DI) library for TypeScript, along with a binding for React.
Stars: ✭ 22 (-47.62%)
Mutual labels:  state-management
reactive state
An easy to understand reactive state management solution for Flutter.
Stars: ✭ 19 (-54.76%)
Mutual labels:  state-management
shadow-reagent
Starting point for ClojureScript apps with shadow-cljs, proto-repl, and reagent.
Stars: ✭ 35 (-16.67%)
Mutual labels:  reagent

rata

Build Status Clojars Project

State management through Datascript and Reagent's track mechanism

usage

Rata hooks itself into the transactor of Datascript. So you just need to register it against Datascript's connection. From that point onwards, you should use rata/q! and rata/pull! with the connection. Rata also provides a transact! functions which accepts a sequence of middlewares; middlewares are useful to add extra capabilities like transaction logging, data based effects, etc.

Check the example directory for a working project

(ns example.core
  (:require [reagent.core :as reagent :refer [atom]]
            [datascript.core :as data]
            [hiposfer.rata.core :as rata]))

(def schema {:user/input {:db.unique :db.unique/identity}})

(defn- logger
  [middleware]
  (fn log* [db transaction]
    (let [transaction (middleware db transaction)]
      (apply js/console.log (clj->js transaction))
      transaction)))

;; state is a standard Clojure Atom containing a Datascript DB
(defonce state (rata/listen! (data/create-conn schema)
                             [logger])) ;; middleware chain

(defn example
  []
  (let [click-count @(rata/q! '[:find ?count .
                                :where [?input :user/input "click"]
                                       [?input :click/count ?count]]
                              state)]
    [:div "For each click, you get a greeting :)"
     [:input {:type "button" :value "Click me!"
              ;; rata/transact! usage here instead of data/transact! ------
              :on-click #(rata/transact! state [{:user/input "click"
                                                 :click/count (inc click-count)}])}]
     (for [i (range click-count)]
       ^{:key i}
       [:div "hello " i])]))

(reagent/render-component [example] (. js/document (getElementById "app")))

(defn on-js-reload [])

License

Copyright © 2018

Distributed under LGPLv3

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].