const addNewGoalHandler = (newGoal) => {
// if the update of the states doesnt depend from the previous one
setTask(task.concat(newGoal));
//also works setTodos([...todos, newTodo]);
// setTask((prevtask) => {
// // if your state depends from the previous one
// return prevtask.concat(newGoal);
// });
};