Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to keep the type of typescript object when submitting on handleSubmitFunction in Formik. #3708

Open
narutodev123 opened this issue Jan 2, 2023 · 0 comments

Comments

@narutodev123
Copy link

narutodev123 commented Jan 2, 2023

Bug report

Current Behavior

interface IUser {
name: string;
noOfSubjects: number;
}

export default function UserDetails(){
const formikForm = useFormik({
initialValues: {name:"",noOfSubjects:0},
handleSubmit: (values)=> {
console.log(values);
//Here the noOfSubject values in string i want to pass it as number in payload
}
})
return(

//Select input with value in number

select_input

)
}

//Current Output : {name:"testing",noOfSubject:"1"}

Expected behavior

In the payload of handle submit i want the values with json like ---- {name:"testing",noOfSubject:1}

Reproducible example

Suggested solution(s)

Additional context

Your environment

Software Version(s)
Formik
React
TypeScript
Browser
npm/Yarn
Operating System
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant