Skip to main content

foundation-redux.createstore

Home > @genesislcap/foundation-redux > createStore

createStore() function

Creates a Redux store with FAST component integration.

Signature:

createStore: <S extends SliceArray>(slices: S, preloadedState: RootStateFromSlices<S>) => StoreReturn<S>

Parameters

Parameter

Type

Description

slices

S

Array of slices to combine into the store

preloadedState

RootStateFromSlices<S>

Initial state that matches the slice structure

Returns:

StoreReturn<S>

Object containing store, actions, selectors, and utility functions

Remarks

This function creates a Redux store that integrates seamlessly with FAST components. It automatically binds actions and selectors, provides subscription methods, and handles FAST Observable notifications.

Example

const { store, actions, selectors, subscribeKey } = createStore(
[userSlice, cartSlice],
{
user: { name: '', email: '' },
cart: { items: [], total: 0 }
}
);