1.0.4 • Published 3 years ago

use-airtable v1.0.4

Weekly downloads
20
License
MIT
Repository
github
Last release
3 years ago

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.

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago