/*App.tsx*/
//체인스코프를 활용한 것이다.
export type ondelete = (targetId:number)=>void;
const [data,setData] = useState<Info[]>([]);
const onDelete:ondelete = (targetId)=>{
const newDiaryList = data.filter((it)=>it.id !== targetId);// 필터를 사용하여 targetId가 아닌 요소들의 새로운 배열을 생성 한다.
setData(newDiaryList);
}/
export type onedit = (targetId:number,newContent:string)=>void
const onEdit:onedit = (targetId,newContent)=>{
setData(data.map((it)=>it.id === targetId?{...it,content:newContent}:it));
}//데이터자료를 순회를 하여 목표id와 같으면 newContent로 값을 변경한다. 아니면 그대로 둔다.