Open History to see the last commit
1import { useEffect, useState } from 'react'
2import { Shape, ShapeStream } from '@electric-sql/client'
3import { options, type Item } from '../shared'
4
5const stream = new ShapeStream<Item>(options)
6const shape = new Shape(stream)
7export function Basic() {
8 const [rows, setRows] = useState<Item[]>([])
9 useEffect(() => shape.subscribe(({ rows }) => setRows(rows)), [])
10 return <pre data-testid="rows">{JSON.stringify(rows)}</pre>
11}