Fork me on GitHub
#reagent
<
2018-08-08
>
kurt-o-sys19:08:00

I'm using reagent with apollo and I'm using mainly higher order components to inject query results into my components. Basically, it looks like this:

(-> add-activity-button
               reagent/reactify-component
               ((query/all-activities-hoc))
               reagent/adapt-react-class)]])

kurt-o-sys19:08:39

However, the add-activity-button needs to get other data as well... what would be the best way to pass other arguments to the add-activity-button component?

kurt-o-sys19:08:14

The function looks like this: (defn add-activity-button [{:keys [day all-activities]}] ...

kurt-o-sys19:08:23

(so, I need to pass day as well)

justinlee19:08:10

@kurt-o-sys I’m not sure how the hoc works, but either the hoc has a mechanism where it passes unknown props or you’ll need to create a factory

kurt-o-sys19:08:07

ok, I was just hoping I could make something funky with reagent/adapt-react-class or reagent/create-element, but neither seem to work fine 😛

justinlee19:08:06

I don’t think so. The issue is that (query/all-activities-hoc) controls the creation of add-activity-button

kurt-o-sys19:08:17

right. agreed.

justinlee19:08:37

so that hoc either has a way to pass through props or you’ll have to preload

kurt-o-sys19:08:35

oh well, it's actually not that difficult to do it otherwise:

(defn add-activity-button [{:keys all-activities}]
  (fn [day] ...))

kurt-o-sys19:08:38

that's good enough 😛

kurt-o-sys19:08:56

or so I thought, I still seem to be missing something...

kurt-o-sys19:08:31

will do it another way. thx.

lilactown20:08:05

this is why we ended up wrapping apollo-client to produce a ratom, instead of using the react-apollo integration

lilactown20:08:35

it was too hard to use the HOC / child-as-fn pattern with reagent