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?

Lone Ranger12:10:09

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

Lone Ranger12: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

Lone Ranger12: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.

Lone Ranger13:10:01

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

Lone Ranger13:10:12

sometimes they happen on a loop in the background