Recebo dois erros fazendo dessa forma e nao entendo, a interface esta certinha mas o typescript acusa esses erros: App:
function App() {
const [tasks,setTasks] = useState<IStudy[] | []>([]);
return (
<div className={style.AppStyle}>
<Form setTasks={setTasks(tasks)}/>
<List tasks={tasks}/>
<Timer />
</div>
);
}
form:
const Form = (setTasks : React.Dispatch<React.SetStateAction<IStudy[]>>)=> {
const [study,setStudy] = useState('')
const [timer,setTimer] = useState('')
function addTask(event: React.FormEvent){
event.preventDefault();
setTasks((oldstudies) => {[...oldstudies, {oldstudies}]});
console.log(study,timer)
}
return(
<form className={style.newTask} onSubmit={addTask}>
<div className={style.inputContainer}>
<label htmlFor="task">
Add your new study task
</label>
<input
type="text"
name="task"
id="task"
value ={study}
onChange = {e => setStudy(e.target.value)}
placeholder="What do you want to study?"
required
/>
</div>
.................... )}