# @alejandro.devop/redux-persistance

> React HTTP Client specially for JSON Apis

Latest version **1.1.0** (published 2023-09-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @alejandro.devop/redux-persistance
pnpm add @alejandro.devop/redux-persistance
yarn add @alejandro.devop/redux-persistance
bun add @alejandro.devop/redux-persistance
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-09-28 |
| First published | 2022-05-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 29.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alejandro Quiroz |
| Maintainers | alejandro.devop |

## Links

- npm: https://www.npmjs.com/package/@alejandro.devop/redux-persistance
- Repository: https://github.com/alejandro-devop/react-redux-persistance
- Issues: https://github.com/alejandro-devop/react-redux-persistance
- npm.io page: https://npm.io/package/@alejandro.devop/redux-persistance

## Dependencies (5)

- [redux](https://npm.io/package/redux.md) ^4.1.2
- [crypto-js](https://npm.io/package/crypto-js.md) ^4.1.1
- [react-redux](https://npm.io/package/react-redux.md) ^7.2.6
- [react-cookie](https://npm.io/package/react-cookie.md) ^4.1.1
- [@reduxjs/toolkit](https://npm.io/package/@reduxjs/toolkit.md) ^1.8.0

## Recent versions

- 1.1.0 (latest) — 2023-09-28
- 1.0.1 — 2022-05-09
- 1.0.0 — 2022-05-09

## README

# @alejandro.devop/redux-persistance

## Index

-   [Installation](#installation)
-   [Usage](#usage)

### Installation

```
yarn add @alejandro.devop/redux-persistance
```

### Usage

```tsx
// myComponent.tsx

/**
 * Use `useSession` hook to connect directly to the context and access
 * the store, the store contains all variables sotored in your redux context
 * - Use `setKey` function to change or create a new session variable value
 * - Use `setAll` function to change multiple states or create multiple session variables
 * Note: The session variables are persisted in  your local storage every time redux updates itself
 */
import { useSession } from '@alejandro.devop/redux-persistance'

const MyComponent: React.FC = () => {
    const { store, setKey, setAll } = useSession()

    const handleSetSessionVar = () => {
        setKey('newKey', 12)
    }

    const handleMultipleKeys = () => {
        setAll({
            mySessionVar: 'new value',
            newKey: 1212
        })
    }

    const { mySessionVar } = store

    return (
        <div>
            <button onClick={() => handleSetSessionVar()}>setKey</button>
            <button onClick={() => handleMultiple()}>setMultiple</button>
            <p>{mySessionVar}</p>
        </div>
    )
}

// app.tsx

/**
 * It all starts by opening the session context, make sure your provider
 * wrapps all the components which should access to the session content
 */
import SessionProvider from '@alejandro.devop/redux-persistance'

const MyApp: React.FC = () => {
    return (
        <SessionProvider
            initialValues={{
                mySessionVar: 'Simple ussage'
            }}
        >
            <div>my app content</div>
        </SessionProvider>
    )
}

export default MyApp
```

---
_Source: https://npm.io/package/@alejandro.devop/redux-persistance · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
