Suggest an edit

Overview

Homebase React

CI CD License GitHub Repo stars Twitter Follow

Supported languages, frameworks and DBs:

  • JS + React + Datascript
  • CLJS + Reagent + Datascript
  • Datahike support coming soon

ClojureScript + Reagent

This is the Javascript docs site. Go here for CLJS + Reagent docs.

Javascript + React

Start by installing homebase-react NPM Version Bundle Size

1# NPM
2npm install homebase-react --save
3
4# Yarn
5yarn add homebase-react

Optionally install the datalog-console chrome extension to inspect the homebase-react DB in your browser.

Quick Start

1import { useCallback } from 'react'
2import { HomebaseProvider, useEntity, useTransact } from 'homebase-react'
3
4const RootComponent = () => (
5  // Create a DB and set some starting data
6  <HomebaseProvider config={{ initialData: [{ counter: { id: 1, count: 0 }}] }}>
7    <App/>
8  </HomebaseProvider>
9)
10
11const App = () => {
12  // Get entity id = 1
13  const [counter] = useEntity(1)
14  const [transact] = useTransact()
15
16  return (
17    <button onClick={() => {
18      // Increment and save the count
19      transact([{ counter: { 
20        id: 1, count: counter.get('count') + 1 
21      }}])
22    }>
23      {/* Render the count */}
24      Increment {counter.get('count')}
25    </button>
26  )
27}

Live demo

What and Why

As data and our need to annotate and organize it grows, so does our need for supporting state in write-heavy applications.

To solve this problem, modern write-heavy applications such as Superhuman, Roam Research, and Facebook Messenger built their own embedded data layers to enable these more sophisticated user experiences.

Homebase React enables developers to access the same embedded datalog database as Roam Research through React hooks. You no longer have to build out a team or learn specialized tools like Clojure in order to build a delightful write-heavy application.

Testimonials

Homebase is executing on the vision of data usage, portability, and management we had when building Firebase. We never got there. I'm excited!

—James Tamplin, Founder/CEO of Firebase

Datalog is the future of end-user programming, personal productivity software, p2p software, etc.

—Chet Corcos, Founding Engineer of Notion