Important Note on Using store.subscribe()
Store.subscribe() can be used for small-scale projects such as ours. We'll use it as a building block for reaching more complex techniques.
There are a few caveats to using store.subscribe() as we’ve done here. It’s a low-level Redux API.
In production, and largely for performance reasons, you’ll likely use bindings such as react-redux (this maps Redux to React and does not allow any other language to use Redux) when dealing with larger apps. For now, it is safe to continue using store.subscribe() for our learning purposes.
In one of the most beautiful PR comments I’ve seen in a long time, Dan Abramov, in one of the Redux application examples said:
The new Counter Vanilla example is aimed to dispel the myth that Redux requires Webpack, React, hot reloading, sagas, action creators, constants, Babel, npm, CSS modules, decorators, fluent Latin, an Egghead subscription, a PhD, or an Exceeds Expectations O.W.L. level.
I believe the same.
When learning Redux, especially if you’re just starting out, you can do away with as many “extras” as possible.
Learn to walk first, then you can run as much as you want.
Get hands-on with 1200+ tech skills courses.