0.4.7 • Published 8 months ago

@electric-sql/react v0.4.7

Weekly downloads
-
License
Apache-2
Repository
github
Last release
8 months ago

React integration for ElectricSQL

Electric is Postgres sync for modern apps.

Electric provides an HTTP interface to Postgres to enable massive number of clients to query and get real-time updates to data in "shapes" i.e. subsets of the database. Electric turns Postgres into a real-time database.

This packages exposes a useShape hook for pulling shape data into your React components.

Shapes and ShapeStreams instances are cached globally so re-using shapes in multiple components is cheap.

Install

npm i @electricsql/react

How to use

Add useShape to a component

import { useShape } from "@electric-sql/react"

export default function MyComponent () {
  const { isLoading, data } = useShape({
    url: "http://my-api.com/shape/foo",
  })

  if (isLoading) {
    return <div>loading</div>
  }

  return (
    <div>
      {data.map(foo => <div>{foo.title}</div>)}
    </div>
  )
}
0.4.7

8 months ago

0.4.6

8 months ago

0.4.5

9 months ago

0.4.4

9 months ago

0.4.3

9 months ago

0.4.2

9 months ago

0.4.1

9 months ago

0.4.0

10 months ago

0.3.6

10 months ago

0.3.5

10 months ago

0.3.4

10 months ago

0.3.3

10 months ago

0.3.2

10 months ago

0.3.1

10 months ago

0.3.0

10 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago

0.0.10

11 months ago

0.0.9

11 months ago

0.0.8

11 months ago

0.0.7

11 months ago

0.0.6

12 months ago

0.0.5

12 months ago

0.0.4

12 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago