Skip to content

c2r0b/redux-persist-transform-bigint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BigInt Redux Serializer

Transformer to serialize BigInt in Redux Persist. This solves the issue of BigInt not being supported by JSON.stringify and avoids the need to use a custom serializer.

Solves issue #1447 of Redux Persist.

Installation

npm install --save redux-persist-transform-bigint

Usage

import { BigIntTransform } from 'redux-persist-transform-bigint'

const persistConfig = {
  key: 'root',
  storage,
  transforms: [BigIntTransform]
}

// ... rest of the code

or with custom options:

import createBigIntTransform from 'redux-persist-transform-bigint'

const persistConfig = {
  key: 'root',
  storage,
  transforms: [createBigIntTransform({
    whitelist: ['myBigIntReducer']
  })]
}

// ... rest of the code

Options

All the config options that can be passed to the transformer are the same as the ones that can be passed to the redux-persist createTransform function (e.g. whitelist, blacklist).