createDomain

Creates a domain

createDomain(name?)

Arguments

  1. name? (string): domain name

Returns

Domain: New domain

Example

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