Used to decouple elements (like MyComponent below) from the store, so they can be used with any store
npm install wc-context-reduxjs
import { html, LitElement } from 'lit-element';
import { connect } from 'pwa-helpers/connect-mixin.js';
import { store } from '../store.js';
import 'wc-context-redux/store-context';class MyParentClass extends connect(store)(LitElement) {
render() {
return html
;
}
}
`Components
`js
import connect from 'wc-context-redux/connect';const mapStateToProps = state => ({
componentProp = state.stateProp
});
const mapDispatchToProps = dispatch => ({
componentMethod: (theParam) => dispatch(actionCreator(theParam))
});
class MyComponent extends connect(mapStateToProps, mapDispatchToProps)(LitElement) {
...
}
``