How to use @rematch/persist - 10 common examples

To help you get started, we’ve selected a few @rematch/persist examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rematch / rematch / plugins / persist / examples / react-persist / src / index.js View on Github external
/* eslint-disable react/jsx-filename-extension */
import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import { init } from '@rematch/core'
import createPersistPlugin, { getPersistor } from '@rematch/persist'
import { PersistGate } from 'redux-persist/es/integration/react'
import * as models from './models'
import App from './App'

const persistPlugin = createPersistPlugin({
	version: 2,
	whitelist: ['persisted'],
})

const store = init({
	models,
	plugins: [persistPlugin],
})

ReactDOM.render(
	<Provider store={store}>
		<PersistGate persistor={getPersistor()}>
			<App />
		</PersistGate>
	</Provider>,
	document.getElementById('root')
github mcnamee / react-native-starter-kit / src / store / index.js View on Github external
/* global */
import { init } from '@rematch/core';
import createPersistPlugin, { getPersistor } from '@rematch/persist';
import createLoadingPlugin from '@rematch/loading';
import storage from 'redux-persist/es/storage';
import * as models from '../models';

// Create plugins
const persistPlugin = createPersistPlugin({
  version: 2,
  storage,
  blacklist: [],
});
const loadingPlugin = createLoadingPlugin({});

const configureStore = () => {
  const store = init({
    models,
    redux: {
      middlewares: [],
    },
    plugins: [persistPlugin, loadingPlugin],
  });

  const persistor = getPersistor();
github EvanBacon / pro-chat / client / src / rematch / Gate.js View on Github external
import { init } from '@rematch/core';
import createRematchPersist, { getPersistor } from '@rematch/persist';
import React from 'react';
import { AsyncStorage, View } from 'react-native';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/es/integration/react';

import * as models from './models';

const persistPlugin = createRematchPersist({
  whiteList: ['user', 'onBoarding'],
  blackList: ['users', 'hasMoreUsers', 'isLoadingUsers'],
  //   throttle: 5000,
  version: 3,
  storage: AsyncStorage,
});

export const store = init({
  models,
  plugins: [persistPlugin],
});
class Gate extends React.Component {
  render() {
    return (
      <Provider store={store}>
        <PersistGate persistor={getPersistor()}>
github EvanBacon / Instagram / rematch / Gate.js View on Github external
import { init } from '@rematch/core';
import createRematchPersist, { getPersistor } from '@rematch/persist';
import React from 'react';
import { AsyncStorage } from 'react-native';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/es/integration/react';

import * as models from './models';

const persistPlugin = createRematchPersist({
  // whiteList: ['user', 'onBoarding'],
  // blackList: ['users', 'hasMoreUsers', 'isLoadingUsers'],
  //   throttle: 5000,
  version: 3,
  storage: AsyncStorage,
});

const PERSIST_DATA = false;
export const store = init({
  models,
  plugins: [PERSIST_DATA && persistPlugin],
});

global.__rematch_store = store;
global.__rematch_dispatch = store.dispatch;
github expo / expo / apps / native-component-list / instagram / rematch / Gate.js View on Github external
import { init } from '@rematch/core';
import createRematchPersist, { getPersistor } from '@rematch/persist';
import React from 'react';
import { AsyncStorage } from 'react-native';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/es/integration/react';

import * as models from './models';

const persistPlugin = createRematchPersist({
  // whiteList: ['user', 'onBoarding'],
  // blackList: ['users', 'hasMoreUsers', 'isLoadingUsers'],
  //   throttle: 5000,
  version: 3,
  storage: AsyncStorage,
});

const PERSIST_DATA = false;
export const store = init({
  models,
  plugins: [PERSIST_DATA && persistPlugin],
});

global.__rematch_store = store;
global.__rematch_dispatch = store.dispatch;
github EvanBacon / Expo-Pillar-Valley / client / src / rematch / Gate.js View on Github external
import { init } from '@rematch/core';
import createRematchPersist, { getPersistor } from '@rematch/persist';
import React from 'react';
import { AsyncStorage, View } from 'react-native';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/es/integration/react';

import * as models from './models';

const persistPlugin = createRematchPersist({
  whiteList: ['score', 'user', 'currency'],
  //   throttle: 5000,
  version: 2,
  storage: AsyncStorage,
});

export const store = init({
  models,
  plugins: [persistPlugin],
});
class Gate extends React.Component {
  static propTypes = {
    children: View.propTypes.children.isRequired,
  };

  render() {
github eveningkid / reacto / src / store / index.js View on Github external
import { init } from '@rematch/core';
import createRematchPersist from '@rematch/persist';
import * as models from './models';

/**
 * Allow information to be locally saved for next sessions.
 * More information about `redux-persist` configuration:
 * @see https://github.com/rt2zz/redux-persist/blob/master/docs/api.md#type-persistconfig
 */
const persistPlugin = createRematchPersist({
  whitelist: ['history', 'ui'],
});

/**
 * This project uses Rematch, built upon Redux.
 * If you're into Redux and don't like creating `actions` all the time,
 * give it a try. I really like it much more.
 * @see https://github.com/rematch/rematch
 */
export const store = init({
  models,
  plugins: [persistPlugin],
});
github eoscostarica / eos-dapp-boilerplate / react-demux-scatter / services / frontend / src / config / store.js View on Github external
import { init } from '@rematch/core'
import createPersistPlugin from '@rematch/persist'

import { locationChangeListener } from 'models/location'

import * as models from 'models'

const persistPlugin = createPersistPlugin({
  key: 'eosdapp',
  whitelist: ['session', 'settings']
})

const store = init({
  models,
  plugins: [persistPlugin]
})

locationChangeListener(store)

export default store
github EvanBacon / Expo-Nitro-Roll / rematch / Gate.js View on Github external
import { init } from '@rematch/core';
import { getPersistor } from '@rematch/persist';
import createRematchPersist from '@rematch/persist';
import React from 'react';
import { Provider } from 'react-redux';
import { PersistGate } from 'redux-persist/es/integration/react';

import * as models from './models';
import { AsyncStorage } from 'react-native';
const persistPlugin = createRematchPersist({
  whiteList: ['score'],
  version: 2,
  storage: AsyncStorage,
});

export const store = init({
  models,
  plugins: [persistPlugin],
});

class Gate extends React.Component {
  render() {
    return (
      <Provider store={store}>
        <PersistGate persistor={getPersistor()}>
          {this.props.children}
github mcnamee / react-native-starter-kit / src / store / index.js View on Github external
const configureStore = () => {
  const store = init({
    models,
    redux: {
      middlewares: [],
    },
    plugins: [persistPlugin, loadingPlugin],
  });

  const persistor = getPersistor();
  const { dispatch } = store;

  return { persistor, store, dispatch };
};

@rematch/persist

Redux-Persist v6 plugin for Rematch. Provides simple redux state persistence using local storage options.

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis

Popular @rematch/persist functions