Error using Checkout bricks on React #132
-
Hello, I'm trying to add Checkout Bricks to my Reac website, bu I'm get this error: Uncaught (in promise) Error: [undefined error] Could not mount brick. Node 'cardPaymentBrick_container' not found at Js.newError
Can someone help me, please? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hello Gabriel, As you are already aware, the Brick needs a container to be rendered and the same container's name should be used when calling About the error you are seeing, I believe it is caused by the conditional. The Brick is trying to find the container on page load while React is still mounting or/and the conditional isn't true. I would recommend you to place the container outside of conditionals and use additional classnames if you need to hide or do some logic based on this Thank you |
Beta Was this translation helpful? Give feedback.
Hello Gabriel,
As you are already aware, the Brick needs a container to be rendered and the same container's name should be used when calling
bricksBuilder.create
, in your case, the div withclassName
"cardPaymentBrick_container"
. Please see the official documentation for further details.About the error you are seeing, I believe it is caused by the conditional. The Brick is trying to find the container on page load while React is still mounting or/and the conditional isn't true. I would recommend you to place the container outside of conditionals and use additional classnames if you need to hide or do some logic based on this
if
.Thank you