Skip to content

Instantly share code, notes, and snippets.

@FMRb
Last active May 22, 2017 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FMRb/71fd32c7dd30431f31e3dbea11f7e2c6 to your computer and use it in GitHub Desktop.
Save FMRb/71fd32c7dd30431f31e3dbea11f7e2c6 to your computer and use it in GitHub Desktop.
Polymer 2 redux + ES6 import
import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import { composeWithDevTools } from 'remote-redux-devtools';
import reducer from './ducks';
const configureStore = (initialState) => {
const enhancer = composeWithDevTools(
applyMiddleware(
thunkMiddleware,
// logger
)
)
return createStore(
reducer,
initialState,
enhancer
)
}
export default configureStore;
<link rel="import" href="redux-mixin.html">
<dom-module id="my-app">
<template>
Hello world!
</template>
<script>
class MyApp extends ReduxMixin(Polymer.Element) {
static get is() { return 'my-app'; }
}
</script>
</dom-module>
{
"entrypoint": "index.html",
"shell": "src/my-app.html",
"fragments": [
"src/my-view1.html",
"src/my-view2.html",
"src/my-view3.html",
"src/my-view404.html"
],
"sources": [
"src/**/*",
"redux/**/*",
"images/**/*",
"bower.json"
],
"extraDependencies": [
"manifest.json",
"node_modules/redux/**/*",
"bower_components/webcomponentsjs/*.js"
],
"lint": {
"rules": ["polymer-2"]
},
"builds": [{
"name": "es5-bundled",
"bundle": true,
"js": {"minify": true, "compile": true},
"css": {"minify": true},
"html": {"minify": true},
"addServiceWorker": true,
"addPushManifest": true
},{
"name": "es6-unbundled",
"js": {"minify": true},
"css": {"minify": true},
"html": {"minify": true},
"addServiceWorker": true,
"addPushManifest": true
}]
}
<link rel="import" href="../bower_components/polymer-redux/polymer-redux.html">
<script>
import configureStore from '../redux/configureStore.js';
const store = configureStore({});
ReduxMixin = PolymerRedux(store);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment