T
TanStack2y ago
like-gold

Understand the useForm.tsx file

I visited your source code, and I was a bit confused. I noticed that this hook calls useStore inside a function, which violates the React hooks rule, So how it possible to do that, and how it's stable? thanks
No description
2 Replies
exotic-emerald
exotic-emerald2y ago
useStore isn't being called inside of a function here. It's being called inside of a custom hook that's being declared and returned by useForm It's admittedly a mind bender, but we're not breaking any rules of React here
like-gold
like-goldOP2y ago
got it, thanks

Did you find this page helpful?