rads / refx

re-frame without Reagent

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

refx

re-frame port using React hooks instead of Reagent.

Designed to be used with Helix or UIx.

Installation

No releases yet, but you can use the Git coordinate:

{:deps {refx.core {:git/url "https://github.com/ferdinand-beyer/refx.git"
                   :git/sha "COMMIT_SHA"
                   :deps/root "core"}}}

Status

This library is in alpha state. While most of the code was copied directly from re-frame, and should be pretty stable, refx's additions need more testing, and the API might still change drastically.

Rationale

See this blog post for an explanation why I started working on refx.

Differences from re-frame

  • subscribe has been replaced with two functions:
    • sub returns a subscription signal, to be used in input functions in reg-sub
    • use-sub is a React hook that return's a subscription's value. These are not atoms and don't need to be dereferenced.
  • query vectors with sub and use-sub do not support the rarely used extra dyn-v argument. See the next point for a superior alternative.
  • query vectors can contain signals returned by sub for dynamic subscriptions
  • subscriptions support other signals than app-db as input. Anything that satisfies the ISignal protocol, which includes atoms.

Examples

See the examples directory for re-frame's todomvc, implemented with Helix and UIx.

License

Distributed under the MIT License.
Copyright © 2022 Ferdinand Beyer

This software uses third-party open-source software.
See NOTICE for individual copyright and license notices.

About

re-frame without Reagent

License:MIT License


Languages

Language:Clojure 98.9%Language:JavaScript 1.1%