alexnm / re-ducks

An attempt to extend the original proposal for redux modular architecture: https://github.com/erikras/ducks-modular-redux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exporting entities in index.js does not work

arvinsim opened this issue · comments

I have this code

// duck/index.js
import reducer from './reducer'
import * as duckTypes from './types'
import * as duckActions from './actions'
import * as duckSelectors from './selectors'

export {
  duckTypes,
  duckActions,
  duckSelectors
}

export default reducer

I tried importing an action but I get an error

// This does not import getFoobar
import { getFoobar } from '../duck'

Any idea why this is the case?

following this pattern you create a named export for the whole actions object. so it would be

import { actions } from '../duck';
actions.getFoobar();