Fork me on GitHub

Good Morning!


Good morning . Great weather for the next 2 weeks


morning lovely people


Yes, lovely spring-like conditions outside.


I guess I'll watch it from the window

πŸ˜„ 4

You can still go out to get food and exercise


Morning all


I'm really glad its so sunny, if it was grey and rainy i think that would negatively impact people a lot more

πŸ‘ 4

I know. I'm just teasing, sorry :)


haha its ok! I just wasn't sure πŸ˜„

Ben Hammond09:03:10

do any of you use React Router

Ben Hammond09:03:28

I'm trying to extract the value of a path param from a Route; all the children components are function-as-React-Components I can see that the

{:history :location :match}
exist as Props in my component but sinceits a component-as-function, I don't know if I can access them

Ben Hammond09:03:19

I can cobble something together with a `

(fn [m]
but it doesn't feel quite right

Ben Hammond09:03:52

React DevTools tells me that the thing I want exists as a Prop

Ben Hammond09:03:13

but I don't know how to access the Prop from within the component function

Ben Hammond09:03:41

theres an assumption that component props are just params passed in to the function

Ben Hammond09:03:17

hmmm. its a Router.Provider div that has the Props in it


Morning peeps


@ben.hammond Looks like react-router has hooks for this now, if you'd prefer that

πŸ‘ 4
Ben Hammond10:03:38

ah. that's what I was missing!

Ben Hammond10:03:00

I want the matches, and the hook is called useHistory

Ben Hammond10:03:16

but I bet it returns the whole data structure

Ben Hammond10:03:02

so this works for me

(defn with-matches []
  (let [m (router/useRouteMatch "/board/:id")]
    (.log js/console "m is " m)
    [:h2 " " js/]))

Ben Hammond10:03:21

called from within

[:> router/Switch
      [:> router/Route {:path "/board"}

πŸ‘ 4
Ben Hammond10:03:29

slightly niggles that I have to specify the path twice but on a worldwide scale not a biggie


Yeah, just be aware of the hooks rules and all that jazz (ie, never invoke a hook in an if or a loop)


not a problem there obviously

Ben Hammond10:03:05

well it IS within a Router switch

Ben Hammond10:03:44

my plan B is to encase the :render property in syntactic sugar something like

(defn with-route
  [props child]
  [:> router/Route
   (assoc props
     (fn [m]
       (.log js/console "m is " m)
       (uix/as-element [child m])))])


wow, they've really gone hooks-mad


react-router knowledge famously ages badly πŸ˜…

Ben Hammond10:03:08

Just for the record, this seems to work just fine

(defn with-params []
  (let [m (router/useParams)]
    (.log js/console "m is " m)
    [:h2 " " js/]))

     [:> router/Switch
      [:> router/Route {:path "/board/:id"}

Adrian Smith12:03:28

hey Bristol's Clojure meetup is online tonight (6pm - 8pm): if you'd like to join us we're in #bristol-clojurians πŸ™‚

πŸ‘ 12
clj 4

@UCJCPTW8J Hi, will this be recorded? I'm not available at that time but really interested in this.

Adrian Smith17:03:48

I don't think that's the initial plan, but we should consider it once we find our feet


If your ok with it, I might screen record this to view later tonight

πŸ‘ 4

No way I can watch until my daughter is asleep


cool just got an email "Tomorrow we will officially relaunching" good to see

πŸ‘ 12

What do people use to run standalone jars on a unix platform and have that service restart if the platform is restarted?

Eamonn Sullivan09:03:14

We use systemd on all our services. We use spec files to create rpms for centos7 and one of the "%post" commands is systemctl enable /usr/lib/<some-application>/<some-application>.service The service file itself has an ExecStart command like java -jar /usr/lib/<some-application>... and Restart set to always.




Anyone got experience with lacinia subscriptions? Been tearing my hair out trying to work out how this is supposed to work…


@dharrigan I’ve used systemd, and I’ve also known a few people to just use nohup <run jar> & or run it inside screen


Nohup sounds good enough for my use case