import * as React from "react"; import { Link, RouteComponentProps } from "react-router-dom"; import { Formik, Form, Field } from "formik"; import { RecipeData } from "@spendcook/api"; import RecipeIngredients from "./RecipeIngredients"; import useSafeDispatch from "../../hooks/useSafeDispatch"; import { postRecipeRequest } from "../../actions"; const initialValues: RecipeData = { title: "", ingredients: [ { ingredientId: "Рис", quantity: 0, }, ], }; export default function RecipeCreate({ history }: RouteComponentProps) { const dispatch = useSafeDispatch(); return ( { dispatch(postRecipeRequest(values)); history.goBack(); }} > {({ values }) => ( <>

{values.title || "Новый рецепт"}


{`<< Назад к меню`}

)}
); }