🚀
ShipClojure
  • README
  • Development
    • Getting Started
    • REPL Workflow
    • AI Development with ShipClojure
    • Getting Updates
    • Formatting code
    • ShipClojure Guiding Principles
  • Backend
    • Migrations
    • Secrets
    • Routing
    • ShipClojure Blog
    • Email
  • Frontend
    • UIx + re-frame
    • HTTP Requests with Re-frame
    • Frontend Navigation with Re-frame
    • Toast Notifications
    • Icons
  • Server Side Rendering
    • Static/Landing pages
  • Auth
    • How Auth works
    • Oauth2 providers
  • Deployment
    • Deployment
  • Decisions
    • 001 - Cookie Sessions
    • 002 - Single Page Application Architecture
    • 003 - Re-frame instead of Refx
    • 003 - Move from cookie sessions to JWT Access + refresh tokens
Powered by GitBook
On this page
  • UIx
  • re-frame
  1. Frontend

UIx + re-frame

PreviousEmailNextHTTP Requests with Re-frame

Last updated 1 month ago

UIx

Shipclojure uses UIx as a react wrapper as it supports more modern react better than consacrated tools like Reagent.

See for more details.

re-frame

While re-frame was developed specifically for Reagent, it can very well be used with other wrappers like Helix and UIx.

  1. Instead of using the clasic subscription as you would in Reagent:

(let [value @(rf/subscribe [:my-value])])

There is a hook to subscribe to the re-frame db that can be used from UIx components.

(ns saas.page
    (:require
        [uix.core :refer [defui $]]
        [re-frame.core :as rf]
        [uix.re-frame :refer [use-subscribe]]))

(defui my-component
    [props]
  (let [value (use-subscribe [:my-value])] ;; reactive subscription from store
    ($ :button {:on-click #(rf/dispatch [:increment-value])} ;dispatching works the same
        (str "The value is " value))))
UIx docs