Skip to main content
Tweeted twitter.com/StackSoftEng/status/848627553418063876
added 30 characters in body
Source Link
nonopolarity
  • 1.8k
  • 1
  • 17
  • 33

I am learning React / Redux, and one feature I like is, when you fire off an Action, you actually provide a request as the "result" or what is called the payload in Redux, and the Redux middleware won't pass this Action to the reducers to compose the final application states. Instead, it will wait for the request, which is a promise, to resolve, and replace the payload with the actual response (including the data). So payload will finally becontain the actual data, and get passed to the reducers to compose the final application states.

This way, it is almost like you can treat it as immediate data. You don't have to worry about the AJAX at all.

So if comparing this to AngularJS and Angular 2, do they provide a pattern like this?

I am learning React / Redux, and one feature I like is, when you fire off an Action, you actually provide a request as the "result" or what is called the payload in Redux, and the Redux middleware won't pass this Action to the reducers to compose the final application states. Instead, it will wait for the request, which is a promise, to resolve, and replace the payload with the actual data. So payload will finally be the actual data, and get passed to the reducers to compose the final application states.

This way, it is almost like you can treat it as immediate data. You don't have to worry about the AJAX at all.

So if comparing this to AngularJS and Angular 2, do they provide a pattern like this?

I am learning React / Redux, and one feature I like is, when you fire off an Action, you actually provide a request as the "result" or what is called the payload in Redux, and the Redux middleware won't pass this Action to the reducers to compose the final application states. Instead, it will wait for the request, which is a promise, to resolve, and replace the payload with the actual response (including the data). So payload will finally contain the actual data, and get passed to the reducers to compose the final application states.

This way, it is almost like you can treat it as immediate data. You don't have to worry about the AJAX at all.

So if comparing this to AngularJS and Angular 2, do they provide a pattern like this?

Source Link
nonopolarity
  • 1.8k
  • 1
  • 17
  • 33

Does AngularJS or Angular 2 provide something similar to the Redux middleware so that AJAX data appear immediately available?

I am learning React / Redux, and one feature I like is, when you fire off an Action, you actually provide a request as the "result" or what is called the payload in Redux, and the Redux middleware won't pass this Action to the reducers to compose the final application states. Instead, it will wait for the request, which is a promise, to resolve, and replace the payload with the actual data. So payload will finally be the actual data, and get passed to the reducers to compose the final application states.

This way, it is almost like you can treat it as immediate data. You don't have to worry about the AJAX at all.

So if comparing this to AngularJS and Angular 2, do they provide a pattern like this?