请参阅以下最小示例代码:
import { FunctionalComponent, h } from 'preact';
const Text: FunctionalComponent = () => {
const tag = 'div'
const props = {}
const children = 'I am children'
return (
h(tag, props, children)
)
}
它说:Cannot invoke an expression whose type lacks a call signature. Type 'typeof h' has no compatible call signatures.
如果我直接使用JSX,就可以了:
如何直接使用h
函数?