Lite Components(小组件)
除了Qwik标准组件(用component$声明的可以懒加载的组件),
Qwik还提供了跟传统框架很像的轻量的小组件lite components。
// Lite component: declared using a standard function.
export const MyButton = (props: { text: string }) => {
  return <button>{props.text}</button>;
};
// Component: declared using `component$()`.
export const MyApp = component$(() => {
  return (
    <div>
      Some text:
      <MyButton text="Click me" />
    </div>
  );
});
上面例子里,MyButton按钮就是一个小组件(lite component)。
小组件的懒加载会合并到Qwik标准组件里。
在这个例子里:
MyButton会和MyApp的渲染函数一起打包。- 无论什么时候
MyApp的渲染函数执行了,都会强行执行MyButton。 MyButton没有 host element。
你可以认为小组件是内联到Qwik标准组件里的。