import PropTypes from "prop-types"; import TaskList from "./components/TaskList"; import { useTasks } from "./useTasks"; export default function InboxScreen({ error }) { const [tasks, dispatch] = useTasks(); const archiveTask = (archive, id) => { dispatch({ type: archive ? "ARCHIVE_TASK" : "INBOX_TASK", id }); }; const deleteTask = (id) => { dispatch({ type: "DELETE_TASK", id }); }; const togglePinTask = (state, id) => { dispatch({ type: state === "TASK_PINNED" ? "INBOX_TASK" : "PIN_TASK", id, }); }; const editTitle = (title, id) => { dispatch({ type: "EDIT_TITLE", id, title }); }; if (error) { return (

Oh no!

Something went wrong

); } return (
); } InboxScreen.propTypes = { error: PropTypes.string, }; InboxScreen.defaultProps = { error: "", };