vrac

phronmophobic 2021-09-23T20:40:44.002300Z

I was just taking another look at vrac. It seems like there's a lot of similarities with https://blog.phronemophobic.com/reusable-ui-components.html. Is there an example for how effects might work?

(defc todo-item-comp [todo-item]
  {:id :my-app/todo-item}
  [:.title {:class {:done? (:todo-item/done? todo-item)}}
           (:todo-item/title todo-item)])
How would you emit a :toggle-todo for todo-item when the user clicks on the todo item?

2021-09-26T03:16:09.012Z

@smith.adriane It would look like:

(defc todo-item-comp [todo-item]
  {:id :my-app/todo-item}
  [:div.title {:class [(when (:todo-item/done? todo-item)
                          :done?)]
               :on-click [:toggle-todo todo-item]}
   [:todo-item/title todo-item]]])