State management for Ionic - Cerebral

Hey guys,

I just wanna share an awesome declarative state and side effects management framework and works really great with ionic. It makes it easy to build complex apps with this and combine with Ionic its a killer combination. Check out my boilerplate (currently its barebone) to see what it can do and play around with it.

Cheers
Andrew

Interesting.

Before I jump into Cerebral, what are comparable libraries I maybe know already?

Redux is the most popular, and there is also mobx. I have experience with Redux they have a different abstraction than Cerebral. Personally I find Cerebral easier to grasp.

If you do jump into the boiler Im curious how long it takes for you to get into the AHA moment and just get how everything works. :slight_smile:

2 Likes

I have an extensive Redux/Ionic app, and I’m interested in compare/contrast. It works well, but there are definitely things about Redux that are annoying. Do you know of a source or two that runs down the relative strengths and weaknesses of Cerebral compared to Redux? Thanks.

1 Like

Hey @AaronSterling,

Here is a couple

Just to give some context where I’m coming from, I used redux and redux sagas on a client project last year, I feel like there is a lot more boiler in redux, we have to keep in mind that pure function and async stuff is seperate and should be kept apart hence sagas, there is also another layer: the action creator which takes a bit of time to get used to for me and its just another layer to make the system work. The abstraction of Cerebral I feel is just right, you just have to wrap your head around actions, signals and compute (there might be other stuff but those 3 are core) + the debugger is killer, makes your app transparent and makes bugs easy to find.

And here is the story of how I ended up with Cerebral. A few months ago I took over development of an app and the code was in a bad shape its a voip/xmpp client so there is a lot going on realtime. The app which was in development for over 2 years. My junior was just going around in circles trying to find bugs without getting anywhere because of a bunch of 1000 lines view controller with a alot dependencies, event handler hook in the view controllers that increments and update messages, we have to deal with device sleeping, reconnection, increment counter, reset counter, update the last message of sync messages with server multiple devices sync, queueing messages… list goes on… everything happening realtime with websockets view stanza.io library

I was shopping around for a solution because this seems imposible… I had experience with redux and I know I want something different than redux to try. I read a bunch of good things and stumbled upon Cerebral but they don’t have an Angular view library !!!.. I think I went to their Discord channel and asked if its possible to use Cerebral with Angular and Christian helped me figure out how to make it work. Here is a ticket referencing the PR :slight_smile: https://github.com/cerebral/cerebral/issues/1024

And now you can use Cerebral with Ionic :slight_smile:

And now I think 3 weeks in we are ripping out old codes like there is no tomorrow and almost at feature parity pre-cerebral. The stakeholder seems happy and can’t wait to test their app.

Cheers
Andrew

2 Likes