How to use @rematch/immer - 3 common examples

To help you get started, we’ve selected a few @rematch/immer 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 springtype-org / springtype / src / packages / state / src / StateManager.ts View on Github external
static createStore(storeInitConfig?: Rematch.InitConfig): Rematch.RematchStore {

        if (!storeInitConfig) {
            storeInitConfig = {};
        }

        if (!storeInitConfig.plugins) {
            storeInitConfig.plugins = [];
        }

        // activate "immer"
        storeInitConfig.plugins.push(immerPlugin());

        //console.log('StateManager initConfig', storeInitConfig);

        // TODO: Construct config based on StoreConfig configurable using @Store(storeConfig: StoreConfig)

        const store = Rematch.init(storeInitConfig);
        StateManager.setStore(store);
        return store;
    }
github guowenfh / vue-cli-react-base / src / store.js View on Github external
import * as models from './models'
import { init } from '@rematch/core'
import immerPlugin from '@rematch/immer'
import createLoadingPlugin from '@rematch/loading'

const immer = immerPlugin()

// see options API below
const options = {}

const loading = createLoadingPlugin(options)

const store = init({ models, plugins: [immer, loading] })
export default store
github modularcode / modular-material-admin-react-pro / src / _state / index.ts View on Github external
import { init, RematchRootState, RematchDispatch } from '@rematch/core'
import immerPlugin from '@rematch/immer'

import dashboard from '_state/appState'

const immer = immerPlugin()

const models = {
  dashboard,
}

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

export type Store = typeof store
export type RootState = RematchRootState
export type RootDispatch = RematchDispatch

export default store

@rematch/immer

Redux-Immer v6 plugin for Rematch. Provides immutable ability for rematch.

MIT
Latest version published 3 years ago

Package Health Score

65 / 100
Full package analysis

Popular @rematch/immer functions