Skip to content

Commit 4e012e5

Browse files
authored
Merge pull request #76 from jramosg/master
Update docs with React 19 and new Reagent module
2 parents 5637d3d + 2894ac4 commit 4e012e5

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

resources/md/clojurescript.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ For more examples of ClojureScript synonyms of common JavaScript operations see
133133

134134
### Reagent
135135

136-
[Reagent](http://reagent-project.github.io/) is the recommended approach for building ClojureScript applications with Kit.
136+
[Reagent](http://reagent-project.github.io/) is the recommended approach for building ClojureScript applications with Kit. You can add Reagent support using the standalone `:kit/reagent` module, which provides Reagent with React 19. Install it by running `(kit/install-module :kit/reagent)` after syncing modules. This module requires `:kit/cljs` and `:kit/html`.
137137

138138
Reagent is backed by [React](http://facebook.github.io/react/) and provides an extremely efficient way to manipulate the DOM using [Hiccup](https://github.com/weavejester/hiccup) style syntax. In Reagent, each UI component is a data structure that represents a particular DOM element. By taking a DOM-centric view of the UI, Reagent makes writing composable components simple and intuitive.
139139

@@ -197,17 +197,22 @@ In the previous example, we used a global atom to hold the state. While it's con
197197

198198
All we have to do is create a local binding for the atom inside a closure. The returned function is what's going to be called by Reagent when the value of the atom changes.
199199

200-
Finally, rendering components is accomplished by calling the `reagent.dom/render` function:
200+
Finally, rendering components is accomplished by calling `reagent.dom.client/render`:
201201

202202
```clojure
203203
(ns myapp
204204
(:require [reagent.core :as reagent]
205-
[reagent.dom :as d]))
205+
[reagent.dom.client :as rdomc]))
206+
207+
(defonce root
208+
(rdomc/create-root (.getElementById js/document "app")))
206209

207210
(defn render-simple []
208-
(d/render [input-field] (.-body js/document))
211+
(rdomc/render root [input-field]))
209212
```
210213

214+
Note: the legacy `reagent.dom/render` API is still available for use with React 17 and React 18 without Concurrent Mode. The `reagent.dom.client` API is recommended for React 19.
215+
211216
### Client Side Routing
212217

213218
Reitit is used to handle both client and server routes.

resources/md/modules.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ user=> (kit/list-modules)
2626
:kit/nrepl - adds support for nREPL
2727
:kit/htmx - adds support for HTMX using hiccup
2828
:kit/hato - adds support for kit-Hato HTTP client
29+
:kit/reagent - adds support for Reagent (with React 19)
2930
:kit/codox - adds support for Codox
3031
:done
3132
user=>

0 commit comments

Comments
 (0)