Reputation: 948
Using the example from react-boiler-plate:
const response = yield call(() => axios.get(requestURL));
Is there a better way to call axios.get, what if i have axios.post? How can I clean this up a bit without having to do '() =>' just to force it into a function.
Thanks for any advice.
Upvotes: 0
Views: 133
Reputation: 45121
If you want to unit test using simple deep equals assertions you could do
const response = yield call([axios, 'get'], requestUrl)
const response = yield call([axios, axios.get], requestUrl)
This allows you to avoid creation of anonymous lambda on every call.
Upvotes: 2