This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-10-21
Channels
- # announcements (3)
- # babashka (98)
- # beginners (69)
- # chlorine-clover (6)
- # cider (24)
- # cljsrn (2)
- # clojure (97)
- # clojure-australia (2)
- # clojure-berlin (6)
- # clojure-dev (57)
- # clojure-dusseldorf (4)
- # clojure-europe (19)
- # clojure-italy (5)
- # clojure-nl (10)
- # clojure-seattle (1)
- # clojure-uk (44)
- # clojuredesign-podcast (13)
- # clojurescript (45)
- # cursive (4)
- # data-science (1)
- # datomic (32)
- # emacs (7)
- # events (5)
- # fulcro (17)
- # java (12)
- # jobs (1)
- # lumo (2)
- # malli (5)
- # observability (16)
- # off-topic (1)
- # pathom (3)
- # pedestal (4)
- # rdf (14)
- # re-frame (54)
- # reagent (4)
- # releases (3)
- # remote-jobs (1)
- # reveal (55)
- # shadow-cljs (34)
- # spacemacs (14)
- # specter (9)
- # tools-deps (16)
- # xtdb (7)
In react-native there is a new Pressable component that can take a function as a child:
<View>
<Pressable
onPress={() => {
setTimesPressed((current) => current + 1);
}}
style={({ pressed }) => [
{
backgroundColor: pressed
? 'rgb(210, 230, 255)'
: 'white'
},
styles.wrapperCustom
]}>
{({ pressed }) => (
<Text style={styles.text}>
{pressed ? 'Pressed!' : 'Press Me'}
</Text>
)}
</Pressable>
<View style={styles.logBox}>
<Text testID="pressable_press_console">{textLog}</Text>
</View>
</View>
When I try passing a clojurescript fn:
[react/pressable {:on-press on-submit}
(fn [^js props]
(let [pressed (when props
(.-pressed props))]
(println pressed)
[next-button pressed]))]
I get functions are not valid as a React child
Is there a way to use this component in cljs?The error appears because you need to return a react element from that function (reagent/as-element [next-button pressed])
instead of [next-button pressed]
same as with render props
👍 3
Hi folks, Could you recommend a react data grid that you've successfully integrated with cljs ?
@geraldodev I already used this library and it works very well : https://devexpress.github.io/devextreme-reactive/react/grid/
👍 6