Uniforms: [Docs] Example submit with hooks?

Created on 14 Aug 2019  路  7Comments  路  Source: vazco/uniforms

  <AutoForm schema={PostSchema} onSubmit={createPost} >

Create post method tries to use hooks. What I'm getting is:

Line 38: React Hook "useMutation" is called in function "createPost" which is neither a React function component or a custom React Hook function react-hooks/rules-of-hooks

question

Most helpful comment

I have started building custom example applications using uniforms on my private account now.
Hoping to have something like create-uniforms-app soon where it will create react application from scratch that has uniforms integrated with all best patterns. Thank you for all the useful hints that helped me to get canonical setup. Docs are one thing, but great user experience starts with hype and good tooling.

All 7 comments

Hi @wtrocki. Can you provide the whole code? I'm not sure what exactly is causing the problem.

I have tried to workaround it by passing client outside hooks.

https://github.com/aerogear/modern-appdev-workshop/blob/master/template/client/src/App.tsx#L28

Generally way to replicate it will be to try to use Forms with Apollo useMutation hook which is default. Use mutation requires people to have some logic within component code. I will try to restore hooks here and give you shout.

It would be great if you could provide a runnable example on CodeSandbox or something similar.

@radekmie Yep. Going to do it. DO you think it is possible to have some example folder that will contain graphql type? I would like to contribute that back

Examples of _what_ exactly? We do have docs and I'd rather see it there.

If you would like to contribute - feel free to do so. @wtrocki If you'll still encounter any issues - write them down here or file a new issue. I'm closing this.

I have started building custom example applications using uniforms on my private account now.
Hoping to have something like create-uniforms-app soon where it will create react application from scratch that has uniforms integrated with all best patterns. Thank you for all the useful hints that helped me to get canonical setup. Docs are one thing, but great user experience starts with hype and good tooling.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dacioromero picture dacioromero  路  5Comments

vfonic picture vfonic  路  3Comments

arrygoo picture arrygoo  路  3Comments

thearabbit picture thearabbit  路  6Comments

simplecommerce picture simplecommerce  路  6Comments