Happy to announce that Rum 0.11.5 has been released with quite a few bug fixes and new features.
For anyone excited about this, now you can use React Hooks in Rum. Hooks work only in function-based React components, but because Rum already generates those when using defc
macro it was trivial to add support for them without breaking changes.
Hooks are compatible only with defc
components and only without any mixins, except rum/static
. This distinction exists because mixins are meant to be used in lifecycle methods of React's class-based components. You should be using either mixins or hooks in a single component, mixing those together would generate class-based components and hooks won't work.
Another important note is that Clojure's equality semantics does not apply to dependencies collection is Hooks, at least as of now. Instead React compares them by identity as usual in JavaScript. For Rum users this means that values in deps collection should be either primitive or identical?
between updates of a component. Unfortunately working around this limitation might be error-prone, so I've decided to leave this improvement for future releases.
rum.core/fragment
macro can be used to render multiple components without a wrapping element.
Now when using rum/render-to-string
from ClojureScript we delegate this to ReactDOMServer
library, which means it's possible to SSR Rum components on Node as well.
Read more on this in docs
Legacy Context API is deprecated now and will be removed in future versions of Rum and React. See readme for usage example of the new API.
String refs are deprecated now. Use function or rum/create-ref
from now on, see readme for usage examples.
Added an API to adapt JS React components for usage in Rum components and a hook for fallback rendering on JVM, which can be used to delegate work to GraalJS or simply render a placeholder markup. See this section in docs.
Merged a PR that makes it possible for Google Closure Compiler to remove unused Rum components when compiling with advanced optimizations.
From now on we use fully qualified names in components names, so you'll be seeing something like this in React DevTools app.core/button
instead of button
.
Fixed a couple of issues with string escaping in HTML attributes when rendering on JVM.