Polymer / pwa-helpers

Small helper methods or mixins to help you build web apps.
BSD 3-Clause "New" or "Revised" License
439 stars 48 forks source link

export default lazyReducerEnhancer #35

Closed busynest closed 6 years ago

busynest commented 6 years ago

the Redux store seems to need a default to work.

googlebot commented 6 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers
hastebrot commented 6 years ago

I'm using this code:

import { lazyReducerEnhancer } from "pwa-helpers/lazy-reducer-enhancer.js"
import { applyMiddleware, combineReducers, compose as _compose, createStore } from "redux"
import thunk from "redux-thunk"

// @ts-ignore
const compose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || _compose

export const store = createStore(
  (state, action) => state,
  compose(lazyReducerEnhancer(combineReducers), applyMiddleware(thunk))
)

Your change would allow to use import lazyReducerEnhancer from ... instead of import { lazyReducerEnhancer } .... I think this is the intention behind this change.

lazyReducerEnhancer is also exported in pwa-helpers.js. So instead of

import { lazyReducerEnhancer } from "pwa-helpers/lazy-reducer-enhancer.js"

you can also use

import { lazyReducerEnhancer } from "pwa-helpers"
keanulee commented 6 years ago

Prefer to keep this as is with no default export. See @hastebrot 's comment.