Suggest an edit

Quick Start

Homebase React creates a local relational database for your React app.

1import { HomebaseProvider } from 'homebase-react'
2
3const RootComponent = () => (
4  <HomebaseProvider>
5    <App/>
6  </HomebaseProvider>
7)

Read from and write to that database via hooks.

1import { useCallback } from 'react'
2import { useEntity, useTransact } from 'homebase-react'
3
4const App = () => {
5  const [counter] = useEntity(1)
6  const [transact] = useTransact()
7
8  const handleClick = useCallback(() => {
9    transact([{ counter: { 
10      id: 1, count: counter.get('count') + 1 
11    } }])
12  }, [counter, transact])
13
14  return (
15    <button onClick={handleClick}>
16      Increment 
17      {counter.get('count')}
18    </button>
19  )
20}