I have this in my code:
const [dimensions, setDimensions] = useState(getDimensions())
const getDimensions = () => {
// stuff
}
The function hasn't be declarated when I call it, so I get an error. But, if I declare it as a traditional function no error is going on.
const [dimensions, setDimensions] = useState(getDimensions())
function getDimensions() {
// stuff
}
Is there any way to do this with an arrow function?