squint 2025-03-04

is there an example of using one lit component from another lit/html block? eg. I want to pass data as you do via lit/html but I can not seem to get it to work. (say I am in the render method of one component) [:div "some words: " this.words [:some-other-comp {:prop this.data}]]in lit you would do <some-other-comp .prop=${this.data}></some-other-comp> - how do you do the .prop from squint/#html ? (I tried :.prop but to no avail)

try replacing 1 with a var name - in lit this is meant to pass in the var directly

if you make it {:.prop xs} when xs is [1 2 3] you will see it embeds said [1 2 3] as a string into the generated markup

{s: "<div><my-element .prop="123"></my-element></div>"}
s: "<div><my-element .prop="123"></my-element></div>"

when it should be <… .prop=${xs}>

(sorry by should I mean how I expect things to work from lit-land)

can you make a playground example like I did above?

I was trying to solve the multiple return problem but realized there's a problem with my solution. Input welcome https://github.com/squint-cljs/squint/pull/630

✅ 1

In other places I "fixed" this by wrapping the expression in a do:

user=> (sc/compile-string "(do 1 2)" {:context :return})
"import * as squint_core from 'squint-cljs/core.js';\n1;\nreturn 2;;\n"
but I prefer a better solution since wrapping in a do messes with namespaced keywords as well

I think I have a reasonable workaround here: https://github.com/squint-cljs/squint/pull/631

🪓 1

I now fixed this problem in a non-hacky way

💯 1