import React, { ChangeEvent, ChangeEventHandler, MouseEventHandler, useState, } from "react"; type Props = { // isEditing: boolean; text: string; handleTitle: Function; }; export const SurveyTitle = ({ text, handleTitle }: Props) => { const [title, setTitle] = useState(text); const [disabled, setDisabled] = useState(true); const handleChange = (e: ChangeEvent) => { const { name, value } = e.target; setTitle(value); }; const onEdit = () => { setDisabled(false); }; const onCancel = () => { setDisabled(true); setTitle(text); }; const handleClick = () => { console.log("title", title); setDisabled(true); handleTitle(title); }; return (
{disabled ? ( <> ) : ( <> )}
); };