Hosted fields throws an error when passing container in React 16
See original GitHub issueGeneral information
- SDK version: 3.57
- Environment: Sandbox
- Browser and OS: Chrome 79 Windows 10
Issue description
When trying to use container instead of selector during hosted fields configuration, it gives an error:
Could not stringify event: Converting circular structure to JSON
--> starting at object with constructor 'HTMLDivElement'
| property '__reactInternalInstance$ahvo3qp93tt' -> object with constructor 'FiberNode'
--- property 'stateNode' closes the circle
I’m using React 16.12 and here’s my configuration:
const cardNumberRef = useRef(null);
...
braintree.hostedFields.create(
{
client: clientInstance,
fields: {
number: {
container: cardNumberRef.current,
placeholder: "4111 1111 1111 1111"
},
...
...
<div
ref={cardNumberRef}
id="card-number"
className="hosted-field"
></div>
It’s trying to JSON.stringify options during following call
(hosted-fields.js:613)
reply(self._merchantConfigurationOptions);
and fails because some of them are HTMLDivElement instances (see screenshot)
From the changelog I see that container param for field is supported since 3.47.0. What am I missing here?
Thanks.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Error Handling in React 16 – React Blog
As React 16 release is getting closer, we would like to announce a few changes to how React handles JavaScript errors inside components....
Read more >JSX element type Elem does not have any construct or call ...
Simply speaking, the type React.Component<any, any> used is the wrong type which remains unresolved. I used React.FunctionComponent and it worked for me.
Read more >How To Manage State with Hooks on React Components
By passing an empty array as an argument to useState , you set the initial empty state as the first value of cart...
Read more >Use React and Spring Boot to Build a Simple CRUD App
React is one of the most popular JavaScript frameworks, ... You will need Java 17 and Node 16 installed to complete this tutorial....
Read more >Stripe JS Reference
fields object. Pass an object to specify payment fields you don't want to collect with the Payment Element.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
👍 I’ve got a fix started that drops the
container
field before sending it to the hosted fields iframes. Will update here when it’s released.Yes, it’s working now. Thank you!