TypeError: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
Possible solutions:
-
Try adding custom-elements-es5-adapter
-
Disable class transforms in Babel
Q: Why are all your example tags prefixed with
x-
?
The x-
prefix is not required. However, it's featured in a lot of Remount's examples for a few reasons:
-
All custom elements require a
-
in the name (source). Prefixing withx-
makes it easy to use single-word elements, which most the examples feature (eg,x-tooltip
). -
One early proposal for custom elements was from Mozilla, in the form of x-tag. It required custom elements to be prefixed with
x-
. While the x-tag proposal is dead now, I think the convention has merit.
Q: Why should I use Remount, and not
$another_library
?
See Comparison.
Q: Can I use Remount to put React components in React components?
Yes, but it'd be better if you just use React. You're sure to have better performance that way.
Q: How do I use it with create-react-app?
Remount works in create-react-app just fine! Try adding this to your src/index.js
:
import { define } from 'remount'
define({
'x-hello': () => {
return <div>Hello from Remount :)</div>
}
})
Q: How do I use Remount on Codesandbox?
The default Codesandbox React template is based on create-react-app. See the answer above.
Q: How do I use Remount on Jsfiddle?
Fork this template.
Q: Will it work with Preact?
Yes! Try it with the preact-compat
package. Make sure you set up your Webpack configuration as the preact-compat docs suggests.
Q: Who's that guy in the README cover photo?
I stole @rem's face from uifaces.com.
Q: I have a question not in this FAQ.
Search the issue tracker to see if anyone else reported your issue. Feel free to open a new issue if not.