Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support injecting a custom argument #9

Open
jednano opened this issue Jul 6, 2019 · 5 comments
Open

Support injecting a custom argument #9

jednano opened this issue Jul 6, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@jednano
Copy link

jednano commented Jul 6, 2019

Redux-thunk has a feature where you can inject a custom argument.

I think this library can support the same feature if it were implemented like so:

helpers/useThunkReducer.js

import { withExtraArgument } from 'react-hook-thunk-reducer';

import BrowserApp from '../BrowserApp';

export default withExtraArgument({ app: new BrowserApp() });

An implementation of this might look like thus:

const saveData = (dispatch, getState, { app }) => {
  app.localStorage.setItem('data', JSON.stringify(data));
};
@nathanbuchar
Copy link
Owner

nathanbuchar commented Jul 8, 2019

Hey @jedmao, thanks for the suggestion! I remember seeing this when I was building out this module and using redux thunk as a reference. However, for the first release I wanted to keep things simple. I'll certainly consider adding this in in future :)

@nathanbuchar nathanbuchar added the enhancement New feature or request label Jul 8, 2019
@nathanbuchar
Copy link
Owner

nathanbuchar commented Jul 8, 2019

PRs are also welcome!

@dsfx3d
Copy link

dsfx3d commented Jul 14, 2019

If no one's working on it. Can I create a PR?

@nathanbuchar
Copy link
Owner

nathanbuchar commented Jul 16, 2019

I've experimented with this and I didn't find a solution I was totally happy with. It would be very helpful to see other approaches and maybe we can work together for a common solution (: definitely give it a shot

@nathanbuchar
Copy link
Owner

You might also consider the solution described in #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants