My state didn't update correctly

Hey everyone,
I using react hook and cordova-plugin-bluetooth-serial to communicate with bluetooth devices.


I’m forgot to setData after I push new element to temp1 array but Data still update when new data received. I also have a problem when I trying setData([ ]), it not change value immediately and when new data received, Data will recover the same array before I clear it, current value in Data array also lost.
Sorry for my English.