squint 2025-03-20

Hey quick question, is there any destructing option on squint for js object props?

can you give an example of what you mean by this

I was searching for something like we can have with this lib on cljs https://github.com/applied-science/js-interop?tab=readme-ov-file#destructuring

can you give a specific code example

destructuring works in general

yeah, I never dared to just try this with js/objects haha

(let [{{href :href} :location} js/document]
  href)
this just works, cool

so you didn't dare to try it before asking? ;)

Yeah, sorry I just took for granted because the xp in cljs

took what for granted?

that object destructuring didn't work? squint is designed around JS objects so it better work

I took for granted that wouldn't work, for some reason, I always thought that destructuring would only work for clojure maps

squint doesn't have clojure maps

it's all JS objects

make sense

hope that didn't scare you ;)

Maybe I'm just still to attached with the old cljs, because this doesn't work there right?

(let [{{href :href} :location} js/document]
  href)
I always used js-interop to be able to do something similar, but never stopped to think that squint is so thin that doesn't have any diff a map than a js/object

that is the major difference between squint and #cherry: squint doesn't have immutable persistent data structures, it just works with the JS objects / arrays directly

🆒 1

I was just playing with preact, and it's really tiny compared to react, I'm using jotai for state management and the whole bundle is just 29kb https://github.com/yogthos/squint-preact-example

👍 1
🤏 1
🎉 8