indexiatech / redux-immutablejs

Redux Immutable facilities.
BSD 3-Clause "New" or "Revised" License
684 stars 36 forks source link

understanding effective use of (use-cases for) redux-immutablejs #30

Open Abhay-Joshi-Git opened 8 years ago

Abhay-Joshi-Git commented 8 years ago

My apologies for asking a silly question. I am new to redux world and started exploring use of immutable data structures recently. I don't think I correctly understand the use-cases for which I should use this library and for which I should not. Perhaps, I really need to understand benefits we get by defining whole state as immutable structure over defining the individual parts as immutable but wrapper state as object.

e.g.  If I have redux state as follows :
 {
   todos , //array of todos 
   visibleFilter //boolean
 }

Now, I tried to defined todos as Immutable.List with single todo as a Immutable.Map. I kept visibleFilter as boolean only. I kept wrapper state object as a plain old object too. Is this case a good candidate where I should use redux-immutablejs ?

If the final/wrapper redux state itself is an array then I can surely see that using redux-immutablejs to make it immutable List would be a great idea as structural sharing would come into play.

I am sure I am missing something here. It would be great If anyone could please explain this.