From 4ca3d6da32607ae68bcf7c14edf32e9517160e73 Mon Sep 17 00:00:00 2001 From: Daniel Neal Date: Wed, 20 Feb 2019 19:29:48 +0000 Subject: [PATCH] Pass initial value to react/useRef --- CHANGELOG.md | 3 +++ project.clj | 2 +- src/hx/hooks.cljs | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58a9a8c..f1acb80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +## [0.3.1] - Feb 20, 2019 +### Fixed +- `<-ref`: Pass initial value to `react/useRef` ## [0.3.0] - Feb 10, 2019 ### Changed diff --git a/project.clj b/project.clj index 445a3da..d39c743 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject lilactown/hx "0.3.0" +(defproject lilactown/hx "0.3.1" :description "An easy to use, decomplected hiccup compiler for ClojureScript & React." :url "https://github.com/Lokeh/hx" :license {:name "Eclipse Public License" diff --git a/src/hx/hooks.cljs b/src/hx/hooks.cljs index ca6c9a4..f2d4582 100644 --- a/src/hx/hooks.cljs +++ b/src/hx/hooks.cljs @@ -32,7 +32,7 @@ "Takes an initial value. Returns an atom that will _NOT_ re-render component on change." [initial] - (let [react-ref (react/useRef) + (let [react-ref (react/useRef initial) update-ref (fn [v] (gobj/set react-ref "current" v))] (Atomified. [react-ref update-ref] #(.-current ^js %))))