Skip to content

Latest commit

 

History

History
80 lines (63 loc) · 3.17 KB

README.md

File metadata and controls

80 lines (63 loc) · 3.17 KB

arm-js-logo

cicd-badge-logo npm-badge-logo license-badge-logo

docs-badge-logo api-reference-badge-logo guides-badge-logo

ARM (API Resource Manager) is a lightweight, MobX-powered API resource manager for JavaScript.
It organizes fetched data into reactive collections, deduplicates in-flight requests automatically,
and gives every record a consistent get/set/save/reload/destroyRecord API - no more hand-rolled loading/error state.

npm install arm-js-library --save

Quick example

import { observer } from 'mobx-react'
import { ARM } from '@/components/providers/arm-config-provider' // your own module - see Getting Started

const App = observer(() => {
  const { isLoading, data: address } = ARM.findRecord('addresses', 2519858, { include: 'user' })

  if (isLoading) return <span>Loading...</span>

  return (
    <input
      value={address.get('attributes.address1')}
      onChange={(event) => address.set('attributes.address1', event.target.value)}
      onBlur={() => address.save()}
    />
  )
})

See the Getting Started guide for full setup (NextJS and non-NextJS), and the guides to see every method running against a real API.

Credits

Contributor Role
Axl Asuncion Designed the original ARM JS logo
Luigi Cruz Early feedback on features and bugs
Dickson Palomeras Early feedback on features and bugs

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please read the CONTRIBUTING.md guide before submitting any changes.