The redux way with ng2-redux
See original GitHub issueCould we implement a very similar version of the redux integration: In the bootstrap
let store = createStore(
combineReducers(reducers),
compose(
applyMiddleware(apolloClient.middleware()),
window.devToolsExtension ? window.devToolsExtension() : f => f
)
);
let providers = [
NgRedux,
APOLLO_PROVIDERS,
defaultApolloClient(apolloClient),
];
enableProdMode();
let ngComponentRef:ComponentRef = await bootstrap(App);
let _ngRedux:NgRedux = ngComponentRef.injector.get(NgRedux);
_ngRedux.provideStore(store);
In the component
@connect({
mapStateToProps(state) {
return {...};
},
mapQueryToProps() {
return {...}
}
})
@Component({...})
export class MyComponent {
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
jayphelps/ng2-redux: Angular 2 bindings for Redux - GitHub
Ng2Redux uses an approach to redux based on RxJS Observables to select and transform data on its way out of the store and...
Read more >Getting Started with Redux & Angular 2 | Rangle.io
For this, we will be using a library called ng2-redux, which is available on npm via npm install ng2-redux . First, we need...
Read more >angular-redux/ng2-redux - Gitter
Hi, wanted to understand how to handle a situation when a component has an input field that get's the data from an observable...
Read more >Building a Redux Application with Angular 2 - Part 1
Redux centralizes the state into a single entity, granting developers access to the most recent state anywhere in the application.
Read more >Angular + Redux — The lesson we've learned for you - Medium
Although I was impressed by Angular's two-way data binding and the ... @angular-redux (aka ng2-redux) uses Angular's features to help ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would say that these are the options I’ve seen being used in the Angular Community:
Adoption is still slow so no clear winner.
For anyone still interested in integrating the Apollo client store with an existing Redux store, here’s a working example app I published.
If you inspect the store with Redux DevTools, you’ll see the apollo state alongside the ng2-redux store state.