T
TanStack2y ago
dependent-tan

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
eastern-cyan
eastern-cyan2y 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
dependent-tan
dependent-tanOP2y ago
got it, thanks

Did you find this page helpful?