# @smalldots/mobx-store

> Store API for MobX

Latest version **0.2.0** (published 2016-04-28) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @smalldots/mobx-store
pnpm add @smalldots/mobx-store
yarn add @smalldots/mobx-store
bun add @smalldots/mobx-store
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2016-04-28 |
| First published | 2016-04-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | hnordt |

## Links

- npm: https://www.npmjs.com/package/@smalldots/mobx-store
- Repository: https://github.com/smalldots/mobx-store
- Homepage: https://github.com/smalldots/mobx-store#readme
- Issues: https://github.com/smalldots/mobx-store/issues
- npm.io page: https://npm.io/package/@smalldots/mobx-store

## Recent versions

- 0.2.0 (latest) — 2016-04-28
- 0.1.0 — 2016-04-28
- 0.0.3 — 2016-04-27
- 0.0.2 — 2016-04-27
- 0.0.1 — 2016-04-27

## README

# Smalldots MobX Store

Store API for MobX

[![npm version](https://badge.fury.io/js/%40smalldots%2Fmobx-store.svg)](https://badge.fury.io/js/%40smalldots%2Fmobx-store)

## Usage

```js
import Store from '@smalldots/mobx-store'
import { observer } from 'mobx-react'
import UserList from './UserList'

function toJSON(response) {
  return response => response.json()
}

const store = new Store()

// Sample hydration
fetch('http://myawesomeapi.com').then(toJSON).then(store.hydrate)

// Sample API call
fetch('http://myawesomeapi.com/users')
  .then(toJSON)
  .then(users => store.set('users', users))

// Sample component
const UserListContainer = observer(() => <UserList users={store.get('users')} />)
```

## API

### hydrate(state)

Hydrates `state`

### get(key)

Gets `key`'s value

### set(key, value)

Sets `key`'s value

### merge(key, value)

Merges `value` into `key` even if `key` doesn't exists

### push(key, value)

Pushes `value` to `key` even if `key` doesn't exists

### remove(key)

Removes `key`

### clear()

Clear all keys/values

### toJSON()

Returns all keys/values as JSON

---
_Source: https://npm.io/package/@smalldots/mobx-store · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
