import { useEffect, useRef, useState } from 'preact/hooks'; import { api } from '../utils/api'; function ListAddEdit({ list, onClose = () => {} }) { const { masto } = api(); const [uiState, setUiState] = useState('default'); const editMode = !!list; const nameFieldRef = useRef(); const repliesPolicyFieldRef = useRef(); useEffect(() => { if (editMode) { nameFieldRef.current.value = list.title; repliesPolicyFieldRef.current.value = list.repliesPolicy; } }, [editMode]); return (