fragment-tag?
check #235fragment?
check #235:did-remount
is now :will-remount
, the name matches semantics closelyUNSAFE
: :unsafe/will-mount
and :unsafe/will-update
useLayoutEffect
hook: use-layout-effect!
:>
syntax for interop with React componentsfragment
macro not supporting optional attributesrum/local
& rum/reactive
components not being updated when rum/static
is enabled #221:did-update
and :key-fn
to specsuse-reducer
's reducer-fn
to match React #213rum.core/set-warn-on-interpretation!
that enables warnings when compiler emits intepretation calls 66d352defcontext
macro #214:<>
deps.edn
use-state
, use-reducer
, use-effect!
, use-callback
, use-memo
and use-ref
hooksrum.lazy-loader
ns and suspense
componentfragment
componentdisplayName
to a fully qualified var name e.g. app.core/button
React.createRef
API:type
attribute value serialization on JVM SSR (#120)rum/with-key
on multiple return components on JVM SSR (#185):class
and :type
attribute values (#93)contextTypes
and childContextTypes
should be specified through :static-properties
instead of :class-properties
rum/portal
method:did-catch
lifecycle callbackrum/hydrate
and updated SSR output to match React’saria-*
values as strings (thx r0man, #114)<
is misplaced in defc
(thx Martin Klepsch, #88, #90)rum.core/react
is used without rum.core/reactive
(thx Martin Klepsch, #82, #87):pre
and :post
checks in rum.core/defc
(thx Martin Klepsch, #81)displayName
in 0.10.0:before-render
and :will-update
weren’t called on subsequent rendersrum.core/state
public again:before-render
should be called on server-side rendering too (thx Alexander Solovyov, #79)A big cleanup/optmization/goodies release with a lot breaking changes. Read carefully!
cursor
got renamed to cursor-in
. New cursor
method added that takes single key (as everywhere in Clojure)rum/mount
returns nil
(because you shouldn’t rely on return value of ReactDOM.render):transfer-state
is gone. All of component’s state is now transferred by default. If you still need to do something fancy on componentWillReceiveProps
, new callback is called :did-remount
callbackcursored
and cursored-watch
mixins. They felt too unnatural to userum/with-props
(deprecated since 0.3.0). Use rum/with-key
and rum/with-ref
instead:did-mount
(obviously, that was a mistake):rum/id
is gone. If you need an unique id per component, allocate one in :init
as store it in state under namespaced keyWhen upgrading to 0.10.0, check this migration checklist:
rum/cursor
calls to rum/cursor-in
:transfer-state
mixins.
(fn [old new] (assoc new ::key (::key old)))
, just delete them.:did-remount
rum/mount
return value. If yes, find another way to obtain component (e.g. via ref
, defcc
etc)rum/with-props
with rum/with-key
, rum/with-ref
or :key-fn
:did-mount
in server-side renderingNow for the good stuff:
alter-meta!
etc:key-fn
to mixins. That function will be called before element creation, with same arguments as render fn, and its return value will be used as a key on that element:before-render
(triggered at componentWillMount
and componentWillUpdate
) and :after-render
(componentDidMount
and componentDidUpdate
) callbackrum/ref
and rum/ref-node
helpers, returning backing component and DOM nodedom-node
, unmount
, request-render
etc). Their implementation just throws an exception. This is to help you write less conditional directives in e.g. :did-mount
or :will-unmount
mixins. They will never be called, but won’t stop code from compiling either.And couple of optimizations:
defc
with no mixins, it’ll be automatically compiled to stateless component)requestAnimationFrame
in a single chunkrender->mixin
, args->state
, element
and ctor->class
rum.core/derived-atom
, a function that let you build reactive chains and directed acyclic graphs of dependent atoms. E.g. you want *c
to always contain a value of *a
plus a value of *b
and update whenever any of them changesrum.core/dom-node
helper that takes state and finds corresponding top DOM node of a component. Can be called in mixins after initial render onlywith-key
on nil-returning component in server rendering (thx Alexander Solovyov, #73):allow-full-screen
, :allowFullScreen
and "allowFullScreen"
would be normalized to allowfullscreen
. As a result, you have to face three problems:
Starting with 0.9.0, Rum will adopt “There’s Only One Way To Do It” policy. All attributes MUST be specified as kebab-cased keywords:
Attribute | What to use | What not to use |
---|---|---|
class | :class | ~~:class-name ~~ ~~:className ~~ |
for | :for | ~~:html-for ~~ ~~:htmlFor ~~ |
unescaped innerHTML | :dangerouslySetInnerHTML { :__html { "..." }} | |
uncontrolled value | :default-value | ~~:defaultValue ~~ |
uncontrolled checked | :default-checked | ~~:defaultChecked ~~ |
itemid, classid | :item-id , :class-id | ~~:itemID ~~ ~~:itemId ~~ ~~:itemid ~~ |
xml:lang etc | :xml-lang | ~~:xml/lang ~~ ~~:xmlLang ~~ ~~"xml:lang" ~~ |
xlink:href etc | :xlink-href | ~~:xlink/href ~~ ~~:xlinkHref ~~ ~~"xlink:href" ~~ |
xmlns | not supported |
To migrate to 0.9.0 from earlier versions, just do search-and-replace for non-standard variants and replace them with recommended ones.
rum/render-static-markup
call for pure HTML templating. Use it if you’re not planning to connect your page with React laterrum/def*
macros now correctly retain metadata that already exists on a symbol (thx aJchemist, #62)rum/render-html
(thx Alexander Solovyov):class-properties
to define arbitrary properties on a React class (thx Karanbir Toor, #44):child-context-types
and :context-types
. Use { :class-properties { :childContextTypes ..., :contextTypes ... } }
instead.setTimeout
in global scope instead of in window (thx Alexander Solovyov, #43)rum.core
under any alias you want (thx Stuart Hinson, #42)rum
to rum.core
to supress CLJS warningschild-context
, child-context-types
, context-types
(thx Karanbir Toor, #37)defcc
macro for when you only need React component, not the whole Rum state:rum/state
) was moved from props
to state
. It doesn’t change a thing if you were using Rum API only, but might break something if you were relaying on internal detailsrum/with-props
macro, use rum/with-key
or rum/with-ref
fns insteadlocal
mixinwill-update
and did-update
lifecycle methods added (thx Andrey Vasenin, #18)defc/defcs
will have displayName
defined (thx Ivan Dubrov, #16)requestAnimationFrame
when used in headless environment (thx @whodidthis, #14)(:require rum)
(defc name < mixin1 mixin2 [args] body...)
defcs
macro that adds additional first argument to render function: state
key
and ref
to rum components via with-props
.forceUpdate
unmounted elementsreactive
mixin:should-update
from reactive
, it now will be re-rendered if re-created by top-level elementreactive
with static
to avoid re-rendering if component is being recreated with the same argsCan you improve this documentation? These fine people already did:
roman01la, Nikita Prokopov, Roman Liutikov & Aleksandr ZhuravlevEdit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close