Skip to content

I am thinking of using this library for my next project. #1102

Answered by harry-whorlow
heecheon92 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @heecheon92,

Like epenflow has mentioned you can place the useForm hook inside a context, and providing you pass along the generics and return the useForm hook you can use it like normal anywhere inside of the context provider without prop drilling.

Tanstack form is supposed to "headless", so in a sense they provide us with the fundamental building block (useForm) and we can use it how we like.

It should looks something like this I guess. (may or may not work, just as an example... I'm at work, so this will will have to do for now)

import React, { createContext, useContext, ReactNode } from 'react';
import { FormOptions, useForm, Validator } from '@tanstack/react-form';

interface Form…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by heecheon92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants