Skip to main content



patronum 1.7.0

import { format } from 'patronum';
// or
import { format } from 'patronum/format';


Sometimes you need to combine several stores into one string, but without format you need to write boring combine with combinator-function.


$string = format`parts${$store}`;
  • on each $store change recalculate template and update $string


format should be called as tagged template literal function

Each part of template literal will be converted to string by String(argument), that's why format supports Store<boolean | string | number>, but also you can pass list of values, and raw values.


Method always returns Store<string>

Example with stores with strings

import { createStore } from 'effector';
import { format } from 'patronum';

const $firstName = createStore('John');
const $lastName = createStore('Doe');

const $fullName = format`${$firstName} ${$lastName}`;
// => John Doe

Example with stores with arrays

import { createStore } from 'effector';
import { format } from 'patronum';

const $list = createStore(['First', 'Second', 'Third']);

const $string = format`We have: "${list}"`;
// => We have: "First, Second, Third"