This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-19
Channels
- # announcements (1)
- # babashka (40)
- # beginners (84)
- # biff (46)
- # calva (37)
- # cherry (2)
- # cider (18)
- # clj-otel (5)
- # clojure (53)
- # clojure-europe (39)
- # clojure-hungary (12)
- # clojure-norway (40)
- # clojure-sweden (2)
- # clojure-uk (2)
- # clojurescript (6)
- # community-development (21)
- # cursive (28)
- # data-science (12)
- # datomic (3)
- # figwheel-main (2)
- # fulcro (12)
- # graalvm (7)
- # gratitude (1)
- # hyperfiddle (23)
- # integrant (9)
- # jobs (2)
- # leiningen (4)
- # lsp (8)
- # malli (3)
- # missionary (1)
- # off-topic (39)
- # polylith (3)
- # portal (33)
- # practicalli (4)
- # re-frame (3)
- # releases (1)
- # sci (53)
- # solo-full-stack (8)
- # sql (5)
- # timbre (9)
I am currently trying to convert my old react toy project to clojurescript and I found this js import statement
import { Row, Col, Avatar, Typography, Card, Tag, Tabs } from 'antd'
const { Text } = Typography
const { Meta } = Card
which I am stumped on how to convert the const { Text } = Typography
part, but after some trial and error, I found that I can do this
(ns something
(:require ["antd" :refer [Row, Col, Avatar, Typography, Card, Tag, Tabs]]))
(def Text Typography.Text)
(def Meta Card.Meta)
is this how you do it? I haven’t managed to find anything regarding this (and I lack keyword to describe that js syntax)I'm pretty sure that's destructuring assignment: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
✅ 1
If you had a lot of nested objects to deal with, the applied-science/js-interop library supports destructuring of js objects
I have tried applied-science as well, but not in the context of destructuring import like this, I’ll take a look