hx.hooks/useMemo
: deps are optional and can be CLJS collection.
useIRef
now usesspecify
instead of a wrapper, and refers to thecurrent
property on itself. This allows you to pass in the ref object directly to DOM ref prop.
- Alpha hooks
useSmartEffect
,useSmartLayoutEffect
,useSmartMemo
that auto-detect dependencies based on the body.
useState
anduseIRef
now properly memoize their dispatch functions to prevent unnecessary renders.useReducer
can now be passed IFn's like multimethods
- Function-as-children were not passing props correctly
<-value
hook mutated ref in render, making it not safe for use in Concurrent React- Converting prop
className
toclass
was only done when hiccup parsing; now also happens indefnc
so it works withcloneElement
. - Improved hiccup interpretation by 10x
- Deprecated Hooks names prepended with
<-
; adopteduseXyzAbc
convention - Changed API for extending components; now you can call
(extend-tag :new-tag ReactComponentToUse)
- A new
hx.hooks.alpha
namespace with experimental Hooks - Alpha-level "reloadable" hook
useReloadable
anduseStateOnce
that persist their state across hot reloads.
<-state
now returns a[value set-value]
tuple instead of an atom.- props passed into hiccup are only converted camel->kebab and back if the element is a keyword.
hx.hiccup
is now cross-platform (CLJ + CLJS) and has been decoupled from React
<-value
hook that caches the Clojure value passed into it, and only returns a (referentially) different value if it isnot=
the previous one. Useful for optimizing renders with things that might return the same data structurally, but with a different reference.<-state
's update function can take arguments likeswap!
, e.g.(set-value assoc :foo "bar")
<-state
can take a third argument: a function that returnstrue
if the new value and previous value are equal. If true, it will not apply the change.- Lots of tests
defnc
anddefcomponent
components now have prettier display names (for e.g. React devtools)defnc
now can be passed a:wrap
option with a collection of higher-order components to wrap the component in
:class
prop having valuenil
when:class-name
not present- Special chars (e.g.
?
) in props being dropped <-effect
where a function is not returned byf
caused an error<-ref
was just broken
:provider
component andhx.react/create-context
function
- Race condition in
<-deref
hook - Props with numbers, two-letter camel-case were dropped or truncated
<-state
:swap!
works on a<-state
atom inside of<-effect
className
prop is available as either:class
or:class-name
when parsing props indefnc
to provide parity with hiccup parser's conversion of:class
prop toclassName
- namespaced keywords are now preserved in props maps
<-ref
: Pass initial value toreact/useRef
- Moved
hx.react.hooks
tohx.hooks
(breaking) <-deref
: no longer takes adeps
argument, but will automatically re-watch if atom argument changes (breaking)<-deref
: Fix bug where two calls on the same atom didn't work as expected<-effect
: Convert second argumentdeps
from CLJS collection to array<-ref
: Have deref return thecurrent
value in React ref (breaking)
- Additional core hooks:
<-memo
<-callback
<-imperative-handle
<-layout-effect
<-debug-value