> For the complete documentation index, see [llms.txt](https://docs.corets.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.corets.io/observables/local-storage-value.md).

# Local Storage Value

Source code is hosted on [GitHub](https://github.com/corets/local-storage-value)

{% tabs %}
{% tab title="yarn" %}

```bash
yarn add @corets/local-storage-value
```

{% endtab %}

{% tab title="npm" %}

```bash
npm install --save @corets/local-storage-value
```

{% endtab %}
{% endtabs %}

Seamless React integration is shipped in a separate package:

{% content-ref url="/pages/-MeeCjonF5MnSCR9TohM" %}
[useValue](/hooks/use-value.md)
{% endcontent-ref %}

This is a `localStorage` version of this package:

{% content-ref url="/pages/-MeeBGx8X2I9UAm40nt5" %}
[Value](/observables/value.md)
{% endcontent-ref %}

## Quick Start

Example of how to use this package in React:

```typescript
import React from "react"
import { createLocalStorageValue } from "@corets/local-storage-value"
import { useValue } from "@corets/use-value"

const Example = () => {
  const counter = useValue(() => createLocalStorageValue("storageKey", 1))
  const increment = () => counter.set(counter.get() + 1)
  
  return (
    <div>
      <button onClick={increment}>{counter.get()}</button>
    </div>
  )
}
```

## createLocalStorageValue() <a href="#createlocalstoragevalue" id="createlocalstoragevalue"></a>

Create a new observable value:

```typescript
import { createLocalStorageValue } from "@corets/local-storage-value"

const value = createLocalStorageValue("storageKey", "some data")
```
