createDomain(name?)

Creates a domain

Arguments

  1. name? (string): Domain name

Returns

(Domain): Namespace for your events, stores and effects.

Example

import {createDomain} from 'effector'
const domain = createDomain() // Unnamed domain
const httpDomain = createDomain('http') // Named domain
const statusCode = httpDomain.event('status code')
const download = httpDomain.effect('download')
const apiDomain = httpDomain.domain('api') // nested domain
const data = httpDomain.store({status: -1})

Try it