This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
I was under the impression that using binding
would make available a variable to all nested-scope fns below/contained within
e.g.
(e/defn BigEasyApp []
(e/server
(binding [this-is-a-server-database (get-that-database)]
(e/client
(SomeHeader.)
(SomeContent.)
(SomeFoot.)))))
but inside
SomeFoot []
gotta explicitly refer to `this-is-a-server-database`
so therefore, gotta pass `this-is-a-server-database` in args??? <
pass this in args
`this-is-a-server-database
`
results in unserializable reference transfer.
so maybe the error is with me, i need to keep the server-tint on the database reference all the way down somehow?Try (e/def this-is-a-server-database) at the namespace level? Then you don't need to pass it. This is how e.g. db connections are defined in the tutorials.
bind the database value in dynamic scope to an e/def, make sure to bind it on the server, and never ever touch it from the client. don’t pass it as an arg to anything except for passing it to clojure in final query, and make sure you do that on the server