[ad_1]
I want to set both of these values in the state to be used later as variables.
const [dollarGoal, setDollarGoal] = React.useState(0);
const [dollarValue, setDollarValue] = React.useState(0);
//fetching donation value
fetch('api', {
method: 'GET',
})
.then(response => response.json())
.then(r => setDollarValue(r.dollarValue))
.then(r => setDollarGoal(r.dollarGoal));
But it gives the error:
Property 'dollarGoal' does not exist on type 'void'.
How do I fix this?
[ad_2]