State is null before sending data in my form.


#1

Hi, i have a problem. I code one function that makes a petition to a server and asks for a dni and compares with dni in the input of my form.

So, in this function i print in console.log the boolean value. Wheter or not, the dni exists in the server. And this works fine.

But, when i change the state with this boolean, this show me a null value for state.

My function is called in the button SEND from my form.

And whole this code is a one function.

I don’t know the reason, plis help me. I can show you my code.


#2

Hey @senpaijeff,

Sharing your code would be great. Ideally in the form of a Snack link or a code snippet.

Cheers,

Adam