Reagent 0.6.0-rc

2016-09-14

Reagent 0.6.0-rc has been given a lot of testing, a new version of React (15.1.0), bug fixing and some small general improvements since 0.6.0-alpha. It has one new feature: general ClojureScript objects can now be used anywhere in markup content.

See this article for more information about Reagent 0.6.0.

Generalized markup

Symbols and keywords can now be used in markup content like this:

hide

Example

Symbols are ok as well as keywords.

Source

(defn mixed []
  [:div
   "Symbols are " 'ok " as well as " :keywords "."])

This makes content conversions behave the same as in attributes, where symbols and keywords have been supported before.

But mainly it avoids confusing error messages when you happen to drop an arbitrary ClojureScript object into the markup, like this:

hide

Example

This is some atom: #<Atom: 0>

Source

(def some-atom (r/atom 0))

(defn confusion-avoided []
  [:div "This is some atom: " some-atom])

This may not be particularly useful, but it is at least a lot better than getting a quite confusing error message from React, that no longer accepts unknown objects…

Any object hat satisfies IPrintWithWriter is allowed, and is converted to a string using pr-str.

Fork me on GitHub