T
TanStack2y ago
dependent-tan

How to render form fields based on result from an API call that uses value in previous form field ?

I have a form which requires and input domain. When domain is provided, I need to call and API and render other fields based on data received. I thought of using form.Subscribe and then using useEffect in children component, but that throws error.
4 Replies
gradual-turquoise
gradual-turquoise2y ago
What error does it throw? Maybe we can look into it?
dependent-tan
dependent-tanOP2y ago
Rendered more hooks than during the previous render. is the error
gradual-turquoise
gradual-turquoise2y ago
Can you show a full code sample by chance?
dependent-tan
dependent-tanOP2y ago
Okay. I'll try to isolate the code and provide you a codesandbox. Just curious to know, my approach is correct ? or is there any other way of doing this ? Maybe some issue on my end couldn't replicate.

Did you find this page helpful?