Skip to content
A simple, easy to use library for React development in ClojureScript.
Clojure HTML JavaScript
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dev
docs
public init Nov 14, 2019
src/helix helix.core/memo Mar 19, 2020
test/helix/impl
.gitignore
LICENSE
README.md update pro-tips section of README Mar 24, 2020
TODOs.md
deps.edn
package.json
project.clj 0.0.10 Mar 24, 2020
shadow-cljs.edn

README.md

Helix

ClojureScript optimized for modern React development.

(ns my-app.core
  (:require [helix.core :refer [defnc $]]
            [helix.hooks :as hooks]
            [helix.dom :as d]
            ["react-dom" :as rdom]))

;; define components using the `defnc` macro
(defnc greeting
  "A component which greets a user."
  [{:keys [name]}]
  ;; use helix.dom to create DOM elements
  (d/div "Hello, " (d/strong name) "!"))

(defnc app []
  (let [[state set-state] (hooks/use-state {:name "Helix User"})]
    (d/div
     (d/h1 "Welcome!")
      ;; create elements out of components
      ($ greeting {:name (:name state)})
      (d/input {:value (:name state)
                :on-change #(set-state assoc :name (.. % -target -value))}))))

;; start your app with your favorite React renderer
(rdom/render ($ app) (js/document.getElementById "app"))

Installation

Clojars Project

You'll want to make sure you have the latest version of react, and whatever renderer you are targeting (e.g. react-dom).

shadow-cljs and npm

npm i react react-dom

shadow-cljs and react-native

See React Native.

lein-cljsbuild / figwheel-main / raw CLJS

Use CLJSJS or package react yourself using webpack, ensuring it is provided as the name "react".

Documentation

Other resources:

Everything in the forward-looking example and discussion has been implemented except for annotating expressions with metadata like ^:memo and ^:callback.

License

Copyright © 2020 Will Acton

Distributed under the EPL 2.0

You can’t perform that action at this time.