Cloudkibo / KiboEngageMobile

MIT License
0 stars 0 forks source link

Learning Redux-Saga #1

Closed zarmeen92 closed 7 years ago

zarmeen92 commented 7 years ago

Ignite Frame is using Redux-Saga for state management. Few Resources: http://jaysoo.ca/2016/01/03/managing-processes-in-redux-using-sagas/ https://yelouafi.github.io/redux-saga/docs/introduction/BeginnerTutorial.html

http://blog.jakegardner.me/redux-thunk-vs-saga/

zarmeen92 commented 7 years ago

Task update:

I read few blogs and made a sample app using Redux-Saga. After reading some blogs on Redux-Saga vs. Redux-thunk(we used in kiboengage web) I came up with following pros and cons

Redux -Saga: Pros : More flexible and testable architecture,requires less code cons : learning and understanding will take time and we will not be able to reuse our existing code

Redux-Thunk: Pros : We can use the as-it-is code (actions and redux side) of kiboengage web in mobile app cons: we will have to look either for a new framework for React-native or need to customize Ignite framework

Please suggest @jekram @sojharo

jekram commented 7 years ago

@zarmeen92

Is this the repo of Redux-Saga

https://github.com/reactjs/redux?

What will be the effort to re-do KiboEngage with Redux-Thunk?

What is the difference between the two Redux?

zarmeen92 commented 7 years ago

Here is the github repo of redux-saga https://github.com/yelouafi/redux-saga

Here are the links for ref: http://blog.jakegardner.me/redux-thunk-vs-saga/ https://shift.infinite.red/using-redux-saga-to-simplify-your-growing-react-native-codebase-2b8036f650de#.qg70hbdcx http://stackoverflow.com/questions/34930735/pros-cons-of-using-redux-saga-with-es6-generators-vs-redux-thunk-with-es7-async https://medium.com/javascript-and-opinions/redux-side-effects-and-you-66f2e0842fc3#.wsus8gapt

What will be the effort to re-do KiboEngage with Redux-Thunk? Ans. Sir I will be able to answer this question after complete learning of Redux-Saga. Initially, it sounds complex

What is the difference between the two Redux? Redux Thunk : is simple to use. Its good when the application is not that complex and we dont require actions to be performed in long chains(such as do step 1 first,then step 2 then step 3 and so on....).

In Redux Saga : we can write a long chain of steps as a set of async calls easily. For eg. in our web application there was task that we need to send a push notification to mobile client when the chat message got saved on kibosupport server. This logic could be easily written Redux Saga in the form of two step process. We can easily enforce the system to send push notifcation only after getting response from kibosupport. Whereas using Redux thunk, my steps were

  1. call action to save message on kibosupport(actions.js)
  2. action then calls function on server(controller.js)
  3. receive response update Reducer(reducer.js)
  4. reducer updates react ui(component.js)
  5. on react side, then i again call a separate action to send push notification(action.js)

so here is a cycle, whereas in redux-saga, (step 2 and step 5) can be written easily in the form of async api calls.

jekram commented 7 years ago

Thanks. Let me review all of these and will respond later today.

jekram commented 7 years ago

@zarmeen92 I am fine using Saga. for now, we would not go back and change KiboEngage.

@sojharo Did you had a chance to look into it?

sojharo commented 7 years ago

Yesterday, Zarmeen had discussed with me KiboEngage mobile client. She mentioned Redux-saga and it is little bit different from Redux which is for web. I didn't look into details of it later.

zarmeen92 commented 7 years ago

Task update: Started learning about Redux-saga from this gitbook https://yelouafi.github.io/redux-saga/docs/introduction/BeginnerTutorial.html

covered Chapter 1, watched video on Saga https://www.youtube.com/watch?v=xDuwrtwYHu8

jekram commented 7 years ago

are these relevant to Iman also?

zarmeen92 commented 7 years ago

Task update

Worked on a sample project using redux saga. Explored shopping-cart example https://github.com/yelouafi/redux-saga/tree/master/examples

jekram commented 7 years ago

Thanks

zarmeen92 commented 7 years ago

task update: watched vdos : Manage side-effects efficiently with Redux Saga at react-europe 2016 https://www.youtube.com/watch?v=aNzxPSPpGeI Understanding Redux saga, Redux Promises and Thunk : https://www.youtube.com/watch?v=QJVdcIlqGwc

Started working on a sample project for Authentication management using redux-saga

jekram commented 7 years ago

Looks like Redux Saga will be more difficult. Is it time to switch to Redux Thunk?

zarmeen92 commented 7 years ago

yes sir. I would be more comfortable in reusing our Redux side existing code. Also the concepts of redux-saga are very difficult for me to grasp.

zarmeen92 commented 7 years ago

we should close this task now

jekram commented 7 years ago

Not a problem. I am always open.