react

"mulling over state management stuff"
2020-06-15T15:27:48.392500Z

I don't have a lot of experience with react. I'm working on a library that expects maps with a ::node key, and applications using the library use that key to display the thing in the right place. I'm currently using regular js dom nodes, but there's no code in the library that is tied to the node representation. I'm curious if this is enough to support react based frameworks as well? Can a react component just be a key in a map and then your app can take the value and render it to the dom? Or are there external requirements of react components I'm missing. Does this depend on the cljs react wrapper I'm using, or are they generally able to output a react component object?

lilactown 2020-06-15T16:19:36.393Z

a react component is just a function or object, you can certainly store it in side of a CLJS map

lilactown 2020-06-15T16:20:57.394400Z

if I follow what you’re saying, you mean something like:

(def lib-data
  {::node some-react-component})

(react/createElement (::node lib-data) ,,,)

2020-06-15T16:21:20.394600Z

perfect!

lilactown 2020-06-15T17:09:57.395100Z

FYI I created a new channel #serenity to talk about the lib I posted above