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.
npm install --save redux-persist-transform-bigint
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
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).