Hacker News new | ask | show | jobs
by fitchb 3941 days ago
I've been following Cerebral (https://github.com/christianalfoni/cerebral) for a while, using it on side projects after playing with Baobab and Flux. It really is an amazing little project and community. And it truly feels like "the next step" after Flux. Christian (@christianalfoni) is a great developer and is doing an excellent job keeping Cerebral focused, small, yet ambitious.

A few things I like about it:

-cerebral-router - https://github.com/christianalfoni/cerebral-router.

It's the first routing implementation I've seen that works in a reactive/component architecture that truly embraces the single state store. Routes simply point to a state in your app and you can update the URL bar as needed. Huge contrast to the normal approach of mapping a URL directly to a set of components in your view layer.

-signals

State changes happen when signals are triggered. Signals then call actions or chains of actions, which are simply functions. You can look at these chains of actions and easily reason about your app's behavior. These actions are also incredibly composable-- using all the nice functional composition techniques you already know: functions can return functions, or function chains, chains can be composed, actions can be reused across chains etc. all without sacrificing readability, which is key!

-debugger - https://www.youtube.com/watch?v=c5lZbJ95tqc

Cerebral has a chrome extension that logs all the signals in your app, so you can easily observe what's happening. You can inspect the state tree and soon you'll be able to inspect the input and output of each action that's run. Even more impressive, you can "time travel" debug ala Elm, Redux by replaying actions back (and forward).

I know I sound extremely bullish (perhaps zealous!). But, I really think Cerebral deserves more exposure. Come by and ask questions on Gitter: https://gitter.im/christianalfoni/cerebral

1 comments

I also have been using Cerebral for a while. In my opinion, this is what Flux should have been.