State update clears the fields #114
Unanswered
samuel-oliveira-fcamara
asked this question in
Q&A
Replies: 1 comment
-
Hello @samuel-oliveira-fcamara, it looks like you are re-rendering your component and consequently the Secure Fields because of state update. That's why it looks like the inputs are being cleared, but in fact what is happening is that you are reloading them completely. Here's some links regarding React lifecycle that may help you. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, for the first time I am implementing an integration with Mecado Pago in a NextJS project, for this I started using the SDK for React and also using the Secure Fields components.
When I started testing the components and the Core methods using mocked data everything was going well until I started to integrate one with the other, because when using some field callback events together with useState, I realized that if a component had the event, when it had an update of state, that would make the field clear.
Example:
In this case, I'm looking for installments as soon as I get the Bin, but I tested several cases. And WHENEVER a state updates, any component (in this case CardNumber and SecurityCode) that has a callback event is cleared
Beta Was this translation helpful? Give feedback.
All reactions