(Question) rebinding createElement on the fly
rmorshea opened this issue · comments
Ryan Morshead commented
I have a case where I want users of an application extension I'm developing to be able to specify what React
they are using. So for example, instead of simply doing:
const html = htm.bind(React.createElement)
I would actually need to do:
let html;
function bindElementConstructor(createElement) {
html = htm.bind(createElement);
}
// set a default constructor
bindElementConstructor(React.createElement);
// make this rebinding function available to users
export bindElementConstructor
function SomeComponent() {
// no use the rebindable 'html' reference in a component
return html`<div />`
Is such a thing possible?
Ryan Morshead commented
Never mind, this doesn't actually solve my problem.