@australis/redux-es
v4.0.0
Published
Repackage redux for use in-browser as a module
Downloads
4
Readme
Redux-es
What:
Repackage redux for use in browser es modules
Install:
# yarn add @australis/redux-es
usage:
# Browser
<script type="module">
window.process = {
env: {
NODE_ENV: localStorage.getItem("NODE_ENV")
}
}
</script>
<script type="module" >
import redux from "/node_modules/@australis/redux-es/dist/index.js";
import middleware from "./middleware.js";
import reducer from "./reducer.js"
const {
createStore,
compose,
applyMiddleware,
} = redux;
const { **REDUX_DEVTOOLS_EXTENSION_COMPOSE** } = window;
const composeEnhancers =
typeof window === "object" && **REDUX_DEVTOOLS_EXTENSION_COMPOSE**
? **REDUX_DEVTOOLS_EXTENSION_COMPOSE**({
// Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
})
: compose;
/**
* @type {import("redux").Store}
*/
const store = createStore(
reducer,
composeEnhancers(applyMiddleware(middleware)),
);
export default store;
</script>