My Datascript tips and tricks

Sometimes you're using something like root structure with entity-id 0, that's convenient to do some routing and stuff like that

I used to query this attrs like this

(let [edit? (first (d/q '[:find [?v] :where [0 :person/edit ?v]] @conn))]]
  edit?)


But it's much better to use is like this via entity

(let [edit? (:person/edit (d/entity @conn 0))]
 edit?)

Комментарии

Популярные сообщения из этого блога

Это пять!