/use-airtable

🛷 Easily use Airtable CRUD methods

Primary LanguageJavaScript

use-airtable

Airtable CRUD to be used in react components

NPM JavaScript Style Guide

Demo

Install

npm install --save airtable use-airtable

Usage

import { useAirtable } from 'use-airtable'

const TodoList = () => {
  const [records, createRecord, updateRecord, deleteRecord] = useAirtable(
    'Tasks',
    AIRTABLE_API_KEY,
    TABLE_BASE_ID
  )

  return (
    <div>
      {records.map((record) => (
        <span>{record.fields.Name}</span>
      ))}
      <button onClick={() => createRecord({ Name: 'New record' })}>
        Add record
      </button>
    </div>
  )
}

Update

<button onClick={() => updateRecord(record.id, { Status: 'In progress' })}>
  Update
</button>

Delete

<button onClick={() => deleteRecord(record.id)}>Delete</button>

License

MIT © ignatif


This hook is created using create-react-hook.