Fork me on GitHub
#reagent
<
2019-10-17
>
johndonne11:10:46

Hi! What is the best way to do AJAX requests in reagent? clj-http maybe?

unbalanced12:10:09

You mean as a result of a user action, i.e., an on-click event?

unbalanced12:10:30

well the general answer, regardless, is you want the result of your ajax request to update your application state. So if you're doing a form-2 component, maybe you want to update the local state -- otherwise, you probably want to update the global state

unbalanced12:10:22

I typically use cljs-ajax or clj-http if I'm doing heavy core.async work on something and it fits in with the workflow

johndonne12:10:42

@goomba >You mean as a result of a user action, i.e., an on-click event? Exactly. Thanks! Sorry for the not-so-detailed question.

unbalanced13:10:01

no problem! sometimes I'll do them on component load, or on page load too

unbalanced13:10:12

sometimes they happen on a loop in the background