1
I have the following code snippet:
const [aulas, setAulas] = React.useState([{
id:1,
title: 'Aula 1',
descricao: 'Matemática',
}, {
id:2,
title: 'Aula 2',
descricao: 'Portugues',
}])
function addAula(aula) {
// aqui eu precisaria atualizar o estado de 'aulas' com uma nova aula.
}
return null
}
However I do not know how I could use a function to set the state and update it, just using this function.
If you can help, thank you, I’m starting in React and learning the principles of statehood yet.
Can you explain more about what you want to show on this page/app? what it does
addAula
? as it should show in html?– Sergio