-
Notifications
You must be signed in to change notification settings - Fork 9
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
Is it possible to yield all the arguments without having to wrap component? #24
Comments
What if we return our arguments as array? Something like this: const MutationWrapper = ({ children, ...props }) => (
<Mutation {...props}>
{(...args) => children(args)}
</Mutation>
)
const [mutation, { loading }] = yield (<Mutation mutation={SOME_MUTATION} />) And in case of using a component that returns a single argument it would be: const [{ data, loading }] = yield (
<Query query={SOME_QUERY} />
) instead of const { data, loading } = yield (
<Query query={SOME_QUERY} />
) I know this is a breaking change, but it would work for all use cases out of the box, without having to create wrappers for components with multiple arguments. |
Hey, thanks for bringing this up @yantakus. |
Much in agree with this |
Having to do this:
when you want to access all arguments (and it's always the case with
Mutation
) negotiates the main benefit ofepitath
(at least for me) - conciseness.I tried to read the code and understand if it is possible to return all the arg by default, but unfortunately I failed to do this quickly, so I decided to open this thread.
The text was updated successfully, but these errors were encountered: