Can't get the updated value inside the call back
dbairavan opened this issue · 1 comments
dbairavan commented
setFilePath(newValue, () => {
console.log(filePath) //Here it's not priting the updated value
getTranslatedText() // In this function also I'm not getting the updated filePath value
})
coryhouse commented
I suggest:
setFilePath(newValue, () => {
console.log(newValue) // Just use the newValue here.
getTranslatedText(newValue) // Pass this function the new value
})