This is a sample application showcasing the integration of Redux into Angular, using ng-redux.
The application simulates an SMS client, with 'mark as unread' capabilities. Redux is used to get the messages state, open message, and unread messages counter in sync.
Run the following commands to get it running locally:
npm install
npm start
open http://localhost:3000/
Here are some files worth looking to get some insights in the benefits of using Redux.
-
In contrast to an standard Angular application, there's no much (or any) information being passed to smart components in the template.
-
Smart components are the ones that connect to the store to gather the information they need. In this component, there's a single input binding with the message id, but the message itself is obtained from the Redux store. Also, actions do not change internal component state, but instead are send directly to the store, with help of the bindings provided by
$ngRedux.connect
. -
In this file you can see how ng-redux is setup for this sample application. The store is configured with its reducers, middleware and enhancers.
-
Redux code is easy to test, as most of it just handles plain JS objects. In this folder there are examples of reducers and action creators test using mocha and chai.
You can run the build process and server with watchers with the following command
npm run watch
This project is licensed under the terms of the ISC license.