# redux-sync-tabs

> a @redux-toolkit framework for cross browswer tabs states

Latest version **0.0.4** (published 2023-12-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install redux-sync-tabs
pnpm add redux-sync-tabs
yarn add redux-sync-tabs
bun add redux-sync-tabs
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2023-12-01 |
| First published | 2023-09-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 20.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Abbas Bagheri |
| Maintainers | abasb75 |
| Keywords | redux, state, saza, react-redux, context |

## Links

- npm: https://www.npmjs.com/package/redux-sync-tabs
- Repository: https://github.com/abasb75/redux-pro
- Homepage: https://github.com/abasb75/redux-pro#readme
- Issues: https://github.com/abasb75/redux-pro/issues
- npm.io page: https://npm.io/package/redux-sync-tabs

## Dependencies (4)

- [react](https://npm.io/package/react.md) ^18.2.0
- [redux](https://npm.io/package/redux.md) ^4.2.1
- [react-dom](https://npm.io/package/react-dom.md) ^18.2.0
- [react-redux](https://npm.io/package/react-redux.md) ^8.1.2

## Recent versions

- 0.0.4 (latest) — 2023-12-01
- 0.0.2 — 2023-10-05
- 0.0.1 — 2023-09-18

## README

# What is Redux-Cross-Tabs?

Redux-Sync-Tabs is a Redux framework that helps to save states in browser storage and synchronize them in different browser tabs.

<image src="https://github.com/abasb75/redux-cross-tabs/blob/main/assets/multi-tab-screen.gif" alt="redux-cross-tabs package">

# Installation :

install with command line:
```sh
npm i @reduxjs/toolkit react-redux redux-sync-tabs
```

# define your slice

```javascript
// store/counterSlice.js

import { createSlice } from "redux-sync-tabs"; // not redux toolkit

export const counterSlice = createSlice({
  name: 'counter',
  initialState,
  reducers: {
    increment: (state) => {
      state.value += 1
    },
    decrement: (state) => {
      state.value -= 1
    },
  },
  
  /** sync tabs options */
  storagble:true,  // if fale redux-sync-tabs ignore it to save on storage and cross tabs
  key:'counter',
  srorageKey:'custom keys',

})

export const { increment, decrement } = counterSlice.actions

export default counterSlice.reducer

```

and darkSlice :

```javascript
// store/darkSlice.js

import { createSlice } from "redux-sync-tabs";

export const darkSlice = createSlice({
  name: 'counter',
  initialState,
  reducers: {
    toggle: (state) => {
      state.state = !state.state
    },
  },

  /** cross tabs options */
  storagble:true,
  key:'dark',

})

export const { toggle } = darkSlice.actions

export default darkSlice.reducer
```

# Create your store 

```javascript
// store/index.js

import { configureStore } from 'redux-sync-tabs';

import darkSlice from './darkSlice';
import counterSlice from './counterSlice';

export const store = configureStore({
  reducer: {
    counter:counterSlice,
    dark:darkSlice,
  },
});


```

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