reagent

A minimalistic ClojureScript interface to React.js http://reagent-project.github.io/
yenda 2020-10-21T14:52:45.075500Z

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?

ferossgp 2020-10-21T15:10:16.076800Z

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

👍 1
2020-10-21T19:03:13.078Z

Hi folks, Could you recommend a react data grid that you've successfully integrated with cljs ?

2020-10-21T19:30:44.079800Z

@geraldodev I already used this library and it works very well : https://devexpress.github.io/devextreme-reactive/react/grid/

👍 2