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

extend the H4R's createStore to accept a reducer function as the first argument #10

Open
shanebdavis opened this issue Mar 11, 2022 · 2 comments

Comments

@shanebdavis
Copy link
Member

shanebdavis commented Mar 11, 2022

The goal here is to allow people to incrementally convert an existing Redux project to H4R. To start, someone would just replace the Redux createStore with the H4R createStore. In order to do this, H4R's createStore needs to support the same API as Redux (it doesn't currently).

After solely replacing Redux's createStore with H4Rs, the rest of the project should still run and work unchanged. From there, the people doing the migration could incrementally either add createReduxModule calls for new slices or start replacing existing Redux state with createReduxModule.

Support this pattern:

import { setStore, createStore } from "hooks-for-redux";

export default setStore(createStore((state) => state));
@shanebdavis
Copy link
Member Author

Note, we should not break backward compatibility.

@shanebdavis
Copy link
Member Author

The focus is to make createStore compatible with Redux’s createStore API. It should also be backward compatible with H4R’s api. I think both are possible.

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

No branches or pull requests

1 participant