OVERMIND
v24
v24
  • Overmind
  • Introduction
  • Quickstart
  • How to learn
  • Videos
  • FAQ
  • Core
    • Devtools
    • Configuration
    • State
    • Actions
    • Effects
    • Operators
    • Server Side Rendering
    • Typescript
  • views
    • React
    • Angular
    • Vue
    • Svelte
  • Addons
    • GraphQL
    • Statechart
  • Guides
    • Connecting components
    • Managing lists
    • State first routing
    • Move to Typescript
    • Testing
    • Connecting to React Native
  • API
    • action
    • addFlushListener
    • addMutationListener
    • createOvermind
    • createOvermindMock
    • createOvermindSSR
    • derived
    • effects
    • events
    • json
    • lazy
    • merge
    • namespaced
    • onInitialize
    • operators
    • reaction
    • rehydrate
    • statemachine
Powered by GitBook
On this page
  1. API

merge

Allows you to merge configurations together.

import {IConfig } from 'overmind'
import { merge } from 'overmind/config'
import * as moduleA from './moduleA'
import * as moduleB from './moduleB'

export const config = merge(moduleA, moduleB)

declare module 'overmind' {
  interface Config extends IConfig<typeof config> {}
}

Note that merge can be useful to combine a root configuration with namespaced or lazy configuration.

import {IConfig } from 'overmind'
import { merge, namespaced, lazy } from 'overmind/config'
import { state } from './state'
import * as moduleA from './moduleA'
import { Config as ModuleB } from './moduleB'

export const config = merge(
  {
    state
  },
  namespaced({
    moduleA
  }),
  lazy({
    moduleB: async (): Promise<ModuleB> => await import('./moduleB').config
  })
)

declare module 'overmind' {
  interface Config extends IConfig<typeof config> {}
}
PreviouslazyNextnamespaced

Last updated 5 years ago