DEV Community

Discussion on: How do you handle asynchronous requests in ReactJS?

Collapse
 
cyberhck profile image
Nishchal Gautam • Edited

I don't have a running example which you can just clone and start using unfortunately, I do have some projects to point you in that direction:

  • Normally SDKs can be generated if you write your APIs right, just using swagger and using autorest to generate all sdks, every time you update your API, it can automatically publish the sdk to npm.
  • Or you can handwrite your own SDK, like here: github.com/devcurate/sdk (is an example), I've used a lot of automation so I don't have to make a release every time I want to use it.
  • That sdk, accepts an instance of Client which comes from tinka

(I've a project where I didn't create sdk separately, but directly in the project itself, because it had only two endpoints: github.com/cyberhck/EventCheckIn-C...) there I configure everything.

github.com/cyberhck/EventCheckIn-C... here you can see that every time a particular action is dispatched, we perform a side effect.

(side effect can be, when user clicks on a message, clear the message notification icon, or making an api call, (or even make completely different api call according to business logic))