Skip to content

Include redux-thunk? #73

Open
Open
@MarcoScabbiolo

Description

@MarcoScabbiolo

Given that it is essential if you want to use asynchronous operations in actions, I think it would be nice to include redux-thunk. Maybe it's just me, but I end up adding it to every proyect. It is a very small dependency and as a middleware it's not invasive at all.

On top of including redux-thunk as a dependency, these would be the changes needed:

At generators/root/templates/store.js:

Add

import thunk from 'redux-thunk';

Change
import { createStore } from 'redux';
To
import { createStore, compose, applyMiddleware } from 'redux';

And change:

const store = createStore(reducers, initialState,
    window.devToolsExtension && window.devToolsExtension());

To:

const store = createStore(reducers, initialState, compose(
  applyMiddleware(thunk),
  window.devToolsExtension ? window.devToolsExtension() : f => f
));

It could be implemented optionally with a prompt.
What do you think? I can make the pull request if you're ok with this request.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions