ziex/test/data/component/children_only.zx
2025-12-23 04:08:28 +06:00

34 lines
871 B
Zig

pub fn Page(allocator: zx.Allocator) zx.Component {
return (
<main @allocator={allocator}>
<Wrapper>
<p>Wrapped content</p>
</Wrapper>
<Container>
<span>First</span>
<span>Second</span>
</Container>
</main>
);
}
const WrapperProps = struct { children: zx.Component };
fn Wrapper(allocator: zx.Allocator, props: WrapperProps) zx.Component {
return (
<div @allocator={allocator} class="wrapper">
{props.children}
</div>
);
}
const ContainerProps = struct { children: zx.Component };
fn Container(allocator: zx.Allocator, props: ContainerProps) zx.Component {
return (
<section @allocator={allocator} class="container">
{props.children}
</section>
);
}
const zx = @import("zx");