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

Create hooks creator "makeUseMulti" #87

Open
eric-burel opened this issue Nov 15, 2021 · 0 comments
Open

Create hooks creator "makeUseMulti" #87

eric-burel opened this issue Nov 15, 2021 · 0 comments
Labels
easy / good first issue Good for newcomers enhancement New feature or request

Comments

@eric-burel
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

When creating a model, you might want to expose reusable hooks with default options:

const useMultiTweets = () => useMulti({model: Tweets})

It is difficult to write such a closure however, because of the parameters structure.

Describe the solution you'd like

const useMultiTweets = makeUseMulti<TweetType>({model: Tweets})

In this example, makeUseMulti handles the merge of paremeters, so that useMultiTweets has the exact same APi as useMulti, but uses Tweets as the default model.

Of course, do the same for other hooks.

@eric-burel eric-burel added enhancement New feature or request easy / good first issue Good for newcomers labels Nov 15, 2021
@eric-burel eric-burel changed the title Create hooks creator Create hooks creator "makeUseMulti" Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
easy / good first issue Good for newcomers enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant