export type ToDo = string export default function () { const toDo = useState('toDo', () => []) const hasToDo = (thing: string) => toDo.value.includes(thing) const addToDo = (thing: string) => { if (!hasToDo(thing)) toDo.value.push(thing) } const removeToDo = (thing: string) => { const index = toDo.value.indexOf(thing); if (index !== -1) { toDo.value.splice(index, 1); } } return { toDo: readonly(toDo), hasToDo, addToDo, removeToDo } }