[BUG] 'Cannot set property 'innerHTML' of undefined' on createWidget if React ref.current is used as element (since release v1.0 !)
See original GitHub issueDescribe the bug
The v1.0 version of this package gives an undefined error on createWidget(element, …) if passed a ref.current value in React.
This worked fine in version 0.34.6. Also, makeWidget is now createWidget apparently, so I think the docs are lagging behind.
To Reproduce Steps to reproduce the behavior:
- Install @typeform/embed (latest)
- Add the following code:
import React, { useRef, useEffect } from 'react'
import * as typeformEmbed from '@typeform/embed'
const MyTypeform = () => {
const typeformRef = useRef(null)
useEffect(() => {
typeformEmbed.makeWidget(typeformRef.current, 'https://form.typeform.com/to/MY_TYPEFORM_ID', {
hideFooter: true,
hideHeaders: true,
opacity: 50,
})
}, [typeformRef])
return <div ref={typeformRef} style={{ height: '100vh', width: '100%' }}></div>
}
Expected behavior I expect the form embed to load as usual.
Current behavior The ref.current value seems to be handled incorrectly when the createWidget method is called.
Problem 1: makeWidget does not exist anymore, please update the docs.
Problem 2: 'Cannot set property ‘innerHTML’ of undefined
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:7
Top Results From Across the Web
React Ref - Cannot set property 'innerHTML' of null
The most likely reason why you are getting the error is that your refs are not attached to a DOM element. If you...
Read more >Content - 3811e52cdfcda707d47b0ed2f8fb560e94e67923
This attribute is used to reference another element by `name` or `id`. Since the `name` and `id` attributes are already blacklisted, a sanitized...
Read more >Uncaught TypeError: Cannot set property 'innerHTML' of null
Uncaught TypeError: Cannot set property 'innerHTML' of null. I'm trying to change the text of a list component based on data I've pulled...
Read more >2008-April.txt - Python mailing list
Python 2.5 does a somewhat better job of releasing memory when actual use falls below peak, but this is a difficult thing to...
Read more >JavaScript-Cookbook-2nd-Edition.pdf - Pepa
Her recent O'Reilly books have covered JavaScript, HTML5 media objects, Ajax, and web graphics. Twitter: @oreillymedia facebook.com/oreilly. Problem solving ...
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 Free
Top 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
This is still an issue, bad bot.
Sorry about the delay on releasing the documentation. it is now up to date for version >= 1 on both Github and our developers portal.
You can also find the latest examples in demo packages in the repo, there is also an example for React.