Closed dscafati closed 1 year ago
Solved by keeping the two Elements mounted and just conditionally showing or hiding their contents
It's likely that the switch is leading the new Elements
to take over the old ones and inherit some options. Glad you got things working as needed! An alternative you can try is setting distinct key
properties on each so React knows they are in fact different components when switching.
What happened?
CheckoutScreenVersion1
is shown.CheckoutScreenVersion2
becomes visiblePaymentElement
s inside of CheckoutScreenVersion2 are rendered based onoptions1
instead ofoptions2
, even though that instance of the provider is no longer on the page, neither wrappingCheckoutScreenVersion2
What I expect to see is the
PaymentElement
inside ofCheckoutScreenVersion2
rendered in the screen based on the configuration fromoptions2
Environment
No response
Reproduction
No response