I have following code,
let firstData = []
if (id) {
const {
data: firstData
} = usedata(
buyingSessionGroupId
)
firstData =
firstData?.getdata?.datavalue ? ? []
console.log("Data is ->", firstData)
}
console.log("Data are ->", firstData)
Now here logs are there in case of first block but after that in second it gives []
. yes it is because of the let is a block scoped . So,
Can any one help me with this ? Don't want to use the var