This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-07
Channels
- # announcements (10)
- # babashka (11)
- # beginners (69)
- # calva (1)
- # cider (2)
- # clj-kondo (35)
- # cljdoc (48)
- # cljs-dev (3)
- # clojure (60)
- # clojurescript (10)
- # community-development (6)
- # cursive (4)
- # datahike (1)
- # datalog (33)
- # deps-new (2)
- # depstar (8)
- # docker (24)
- # fulcro (1)
- # graphql (4)
- # honeysql (5)
- # java (2)
- # leiningen (2)
- # missionary (3)
- # off-topic (104)
- # pedestal (8)
- # polylith (18)
- # portkey (3)
- # reagent (7)
- # reveal (1)
- # rewrite-clj (4)
- # shadow-cljs (19)
- # specter (3)
- # tools-deps (2)
Hey, are these snippets equivalient? ClojureScript
(defn tab-panel [{:keys [children value index & other]}]
[:div (merge {:role "tabpanel"
:hidden (not= value index)
:id (str "simple-tabpanel-" index)} other)
(if (= value index)
[box {:py 3} children])])
JavaScript
function TabPanel(props) {
const { children, value, index, ...other } = props;
return (
<div
role="tabpanel"
hidden={value !== index}
id={`simple-tabpanel-${index}`}
{...other}
>
{value === index && (
<Box py={3}>
{children}
</Box>
)}
</div>
);
}
{:keys [children value index & other]}
What you're intending with & other
is incorrect. You'd want,
{:keys [children value index] :as props}
and then use the props.There is no way in CLJ(S) to do the ...other
bit here,
const { children, value, index, ...other } = props;
You will have to think differently, like dissoc
ing children
, value
and index
from the props
in the suggestion above.^ to illustrate why {:keys [children value index & other]}
doesn't work as you intended.
Yea, JSX.
Can anyone find out why this test isn't running? (you can watch tests with bb watch-tests
or by executing the corresponding command from bb.edn
manually)
https://github.com/borkdude/nbb/blob/df0edd3c2a560ea3954dc6943a228c3d49668e75/test/nbb/main_test.cljs#L25