import { createDomain, type Domain } from "effector";

Methods

createDomain(name?)

Creates a domain

Formulae

createDomain(name?): Domain

Arguments

  1. name? (string): domain name. Useful for debugging

Returns

Domain: New domain

Examples

import { createDomain } from "effector";

const domain = createDomain(); // Unnamed domain
const httpDomain = createDomain("http"); // Named domain

const statusCodeChanged = httpDomain.createEvent();
const downloadFx = httpDomain.createEffect();
const apiDomain = httpDomain.createDomain(); // nested domain
const $data = httpDomain.createStore({ status: -1 });

Try it

Contributors