use-airtable

1.0.4 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i use-airtable

Weekly Downloads

26

Version

1.0.4

License

MIT

Unpacked Size

610 kB

Total Files

23

Last publish

Collaborators

  • ignatif