portal

https://github.com/djblue/portal
plexus 2021-05-28T07:12:48.014900Z

This is just delightful

(defn hiccup [html]
  (with-meta
    html
    {:portal.viewer/default :portal.viewer/hiccup}))

(defn pixel-grid [pixels]
  (hiccup
   [:div {:style {:display "flex"}}
    (for [col pixels]
      [:div {:style {:display "flex" :flex-direction "column"}}
       (for [color col]
         [:div {:style {:width "5px" :height "5px" :background-color (str "rgba(" (str/join "," color) ")")}}])])]))

(tap> (pixel-grid (:pixels @state)))

2
🆒 4
djblue 2021-05-28T16:58:30.015500Z

Since reagent is rendering this, I wonder if you still need a :key on list elements :thinking_face:

plexus 2021-05-28T18:34:18.015700Z

You never really need that, right?

djblue 2021-05-28T18:36:28.015900Z

You would need it if you are updating large lists, but most of the time you can get by without it 👌

plexus 2021-05-28T18:44:39.016100Z

And since in this case you won't get updates it won't matter in terms of performance either

plexus 2021-05-28T18:45:41.016300Z

Right, what you said :)