const onSubmit = (data) => {
output ? setOutput(false) : setOutput(true)
sendData(data)
}
async function sendData(data) {
await axios({
url:"someurl",
data: { data },
headers: {
'Access-Control-Allow-Origin': '*'
},
});
}
Here I am calling SubmitData function and passing to it some data from front-end, and then calling SendData function to post this data via axios to firebase real-time database. I didn't create backend of the app, so instead tried to learn doing API requests using firebase. Can anybody please help me to figure this out? Many thanks ahead!