Javascript Function Not Returning Updated Data Based On Updated State

Javascript Function Not Returning Updated Data Based On Updated State