[shadow-arborist] Exploring a CLJS world without React (Preview)

Following the discussion on reddit I open sourced some of the code I have been working since I think there are some ideas in there worth exploring. The goal is to explore a React replacement written in pure CLJS.

This is not an actual library yet. Just a collection of ideas with a proof of concept implementation.

I wrote some more about the motivations and implementation in the README.

Happy to discuss it here further if anyone is interested.

13 Likes

Question: how do you handle list updates?

Short answer: A separate protocol implementation.

I’ll expand on this in the docs some more but basically you call

(let [items [{:id 1 :text "foo"}]]
  (<< [:ul 
       (sa/render-seq items :id
         (fn [{:keys [id text] :as item}]
           (<< [:li {:data-id id} text]))])

So render-seq takes a collection, a key-fn and a function that will render each item (could be a component, which I’ll also cover later). It is currently just a function call, maybe some syntax sugar via a macro could be added. Still debating whether or not this should have special form in the fragment macro.

I’ll try to add some more docs soon. There are a bunch of interesting things we can do here too.

2 Likes

Are you considering interoperability between existing ui components which are written using react.

1 Like

Probably not no. It’ll be easy to embed a react component anywhere in the tree but that part of the tree will then belong to react, so it would control all the children.

See if there’s any inspirations from Vue side…

There is also an awesome Hoplon library with similar ideas.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.