You Might Not Need Redux
Dan Abramov
17.3K71

You might not need redux when you use counters, but for me, Redux is extremely helpful to have testable client-server business logic. In my project, card game, I’m able to do this:

const [serverStore, {clientStore0, User0}] = mockStores(1);
clientStore0.dispatch(roomCreateRequest());
const Room = serverStore.getState().get('rooms').first();
expect(serverStore.getState().get('rooms'), 'serverStore.rooms').equal(Map({[Room.id]: Room}));
expect(clientStore0.getState().get('room'), 'clientStore.room').equal(Room.id);
expect(clientStore0.getState().get('rooms'), 'clientStore.rooms').equal(Map({[Room.id]: Room}));

So for 5 lines of code i tested that client can send request to create a room, server will handle it and client will get the room back. I can’t think how it could be done so pure and easy without Redux.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.