Closed X-neuron closed 3 years ago
I'm not sure I understand the question here. HTM doesn't change anything about how JSX components work, it just makes component references explicit:
<div /> === html`<div />`
<Foo /> === html`<${Foo} />`
<a.b /> === html`<${a.b} />`
const A = x[y];<A /> === html`<${x[y]} />`
The last case is valid in HTM - maybe that's what you were referring to? The component reference is completely opaque to HTM, it's just the result of any JS expression. You could even do html`<${(await getComponents())[42]}>`
.
when useing jsx component, the reference must point to a component
In some scenarios, use the template function of 'html' to generate route components dynamically with react lazy suspense functions
Is there a way to solve this with this tool?
https://codesandbox.io/s/babel-codegen-test-836r5?file=/app/pages/page3/index.js