squint

2025-03-04T23:45:00.164869Z

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)

2025-03-05T18:35:53.849519Z

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

2025-03-05T18:36:27.863569Z

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

2025-03-05T18:36:42.135079Z

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

2025-03-05T18:37:12.503779Z

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

2025-03-05T18:37:21.939349Z

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

borkdude 2025-03-05T20:36:58.853529Z

can you make a playground example like I did above?

plexus 2025-03-04T06:37:42.143939Z

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
borkdude 2025-03-04T10:56:29.151079Z

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

borkdude 2025-03-04T12:10:43.901109Z

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

🪓 1
borkdude 2025-05-09T17:24:51.499499Z

I now fixed this problem in a non-hacky way

💯 1