Proposal for a standard structure for PubSweet components
Each component could contain the following structure:
- /client = React components
- /client/actions = redux action creators
- /client/reducers = redux action reducers
- /client/constants = redux action constants
- /server = routes
That would allow the following usage:
import { Blog } from 'pubsweet-component-blog/client'
// or
import Blog from pubsweet-component-blog/client/Blog
<Blog/>
import actions from 'pubsweet-component-blog/client/actions'
// or
import { create } from 'pubsweet-component-blog/client/actions'
// or
import create from 'pubsweet-component-blog/client/actions/create'
create({ title: 'foo' })
import blogReducers from 'pubsweet-component-blog/client/reducers'
combineReducers(...reducers, ...blogReducers)
On the server side, component routes could be used like this:
import blog from 'pubsweet-component-blog/server'
app.use(blog)