All Projects → zewa666 → aurelia-hoc-store

zewa666 / aurelia-hoc-store

Licence: MIT license
An Aurelia application showing the use of higher order components and a single state approach.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to aurelia-hoc-store

Store
Aurelia single state store based on RxJS
Stars: ✭ 103 (+415%)
Mutual labels:  rxjs, state-management, aurelia
Ayanami
🍭 A better way to react with state
Stars: ✭ 129 (+545%)
Mutual labels:  rxjs, state-management
Sigi
Well designed effect management framework for complex frontend app
Stars: ✭ 95 (+375%)
Mutual labels:  rxjs, state-management
Reactive State
Redux-clone build with strict typing and RxJS down to its core. Wrist-friendly, no boilerplate or endless switch statements
Stars: ✭ 135 (+575%)
Mutual labels:  rxjs, state-management
Mini Rx Store
Lightweight Redux Store based on RxJS
Stars: ✭ 32 (+60%)
Mutual labels:  rxjs, state-management
House
Proof of Concept and Research repository.
Stars: ✭ 37 (+85%)
Mutual labels:  rxjs, aurelia
Bloc.js
A predictable state management library that helps implement the BLoC design pattern in JavaScript
Stars: ✭ 111 (+455%)
Mutual labels:  rxjs, state-management
mst-effect
💫 Designed to be used with MobX-State-Tree to create asynchronous actions using RxJS.
Stars: ✭ 19 (-5%)
Mutual labels:  rxjs, state-management
ng-effects
Reactivity system for Angular. https://ngfx.io
Stars: ✭ 46 (+130%)
Mutual labels:  rxjs, state-management
vuse-rx
Vue 3 + rxjs = ❤
Stars: ✭ 52 (+160%)
Mutual labels:  rxjs, state-management
Platform
Reactive libraries for Angular
Stars: ✭ 7,020 (+35000%)
Mutual labels:  rxjs, state-management
space-state
Demo app for Subjecting State to Good Behavior
Stars: ✭ 46 (+130%)
Mutual labels:  rxjs, state-management
Focal
Program user interfaces the FRP way.
Stars: ✭ 613 (+2965%)
Mutual labels:  rxjs, state-management
Rxstate
Simple opinionated state management library based on RxJS
Stars: ✭ 46 (+130%)
Mutual labels:  rxjs, state-management
Fluorine
[UNMAINTAINED] Reactive state and side effect management for React using a single stream of actions
Stars: ✭ 287 (+1335%)
Mutual labels:  rxjs, state-management
Akita
🚀 State Management Tailored-Made for JS Applications
Stars: ✭ 3,338 (+16590%)
Mutual labels:  rxjs, state-management
ngx-model-hacker-news-example
Example repository with Hacker News implementation using Angular, Angular Material & ngx-model
Stars: ✭ 27 (+35%)
Mutual labels:  rxjs, state-management
reactive-store
A store implementation for state management with RxJS
Stars: ✭ 29 (+45%)
Mutual labels:  rxjs, state-management
Model
Angular Model - Simple state management with minimalist API, one way data flow, multiple model support and immutable data exposed as RxJS Observable.
Stars: ✭ 242 (+1110%)
Mutual labels:  rxjs, state-management
ngx-mobx
Mobx decorators for Angular Applications
Stars: ✭ 14 (-30%)
Mutual labels:  rxjs, state-management

Aurelia with higher order components and a single state store

This project shows an example of how you can structure your application to use an React/Redux architecture, yet not having to sacrifice flexiblity and power of Aurelia's two-way binding. Besides that the store implementation is based on RxJS instead of Redux. It uses a classic service class as backbone. The reason for this is to allow a smoother introduction of new concepts in an existing app.

Setup

  • Checkout the repository
  • npm install -g aurelia-cli to install the Aurelia CLI globally
  • install the examples dependencies inside the projects root with npm install
  • Make sure to install the Redux DevTools Browser extension (e.g for Chrome here)
  • run au run --watch to get started
  • open your browser with the address http://localhost:9000
  • you should notice the active Redux DevTools extension in your browser

Recommended way to review the example

The sources, both code and templates, are fully documented to provide a good understanding how one feature and concepts builds upon the other. In order to get the most out of your first contact I'd recommend the following process:

  1. Start with the main.ts, Aurelia's main entry point.
  2. Go on with app.ts and app.html.
  3. After that start with the higher order components ViewModel developer-overview.ts and View developer-overview.html.

Do not get distracted by any references from the store, models or service classes yet

  1. Switch to the smart component add-developer-form.ts and add-developer-form.html.
  2. Continue with the dumb component list-developers.ts and list-developers.html
  3. Now its time to switch to the service and store implementation. Start with the developer-models.ts first.
  4. Continue to the classic service developer-service.ts.

Note that this service could be used as it is in a classic MVVM / Two-Way-Binding approach.

  1. Finish your journey with the developer-store.ts.

Feedback

  1. How do we enable support for middlewares, like Redux does?

A middleware is comparable to Express.js like middlewares, as such that it adds different functionallity before the actual request response cycle is complete. In Redux this means we're adding features which overload the action dispatcher. In combination with RxJS BehaviorSubjects, that means we'd need to override the next method to apply additional middlewares before processing our own function. This is best done by subclassing the original BehaviorSubject and creating our own MiddlewareBehaviorSubject as depicted in the branch middleware-behavior-subject. You can find the extended Subject over here

  1. How to unit test the store and state depending components?

Testing is always an important question when evaluating a new approach. By using RxJS as the base for this example, coupled with Aurelia's Component Tester, we're having a fully versatile solution to cover each test scenario. Inside the folder test/unit you can find the files developer-store.spec.ts - for the store based unit tests - and list-developer.spec.ts depicting how to test a dumb component, which accepts data via attribute inputs. The later is a TestBed approach, showing a integration test, covering the DOM. The unit tests contain inline comments for all interesting details

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].