Fork me on GitHub

In react-native there is a new Pressable component that can take a function as a child:

        onPress={() => {
          setTimesPressed((current) => current + 1);
        style={({ pressed }) => [
            backgroundColor: pressed
              ? 'rgb(210, 230, 255)'
              : 'white'
        {({ pressed }) => (
          <Text style={styles.text}>
            {pressed ? 'Pressed!' : 'Press Me'}
      <View style={styles.logBox}>
        <Text testID="pressable_press_console">{textLog}</Text>
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 ?