Zero
https://gyazo.com/fa98f6bfefabb386f5c69a765ebd1538
なんかすごそうmrsekut.icon
2024/10/30現在まだちゃんと公開されていない
code:ts
function Playlist({id}: {id: string}) {
// This usually resolves *instantly*, and updates reactively
// as server data changes. Just wire it directly to your UI –
// no HTTP APIs, no state management no realtime goop.
const tracks = useQuery(
zero.playlistTrack.join(zero.track).select(
'track.*',
)
.where('playlistTrack.playlistID', '=', id)
.orderBy('playlistTrack.order', 'asc')
.limit(1000)
);
const onStar = (id: string, starred: boolean) => {
zero.track.update({
id,
starred,
});
}
return (
<div>
{tracks.map(track => (
<TrackRow track={track} onStar={onStar}/>
))}
</div>
);
}