'How can i pass the values of formik inputs to an object?

I'm using formik for validate my checkout form and upload the order into my db in firebase. The issue is that "values" isn't defined, because I don't have states as well on my code, since I'm using formik. How can I pass the values of my inputs to the order object?

    const formik = useFormik({
    initialValues: {
        email: "",
        name: "",
        address: "",
        phone: "",
        apartment: "",
    },
    validate: validate,
    onSubmit: values => {
        console.log(values.email)
    }
})

const order = {
    buyer: { name: values.name, email: values.email, phone: values.phone, address: values.address, apartment: formik.values.apartment },
    items: cart,
    total: total,
    date: serverTimestamp()
};


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source