State
/ API Reference
State
/ API Reference

useStoreWithMiddleware

useStoreWithMiddleware is very similar to useStore. It is a so-called factory that adds middleware to the default useStore.

Arguments

ArgumentTypeDescription
middlewareArray?A list of middleware that is added to the default useStore

Returns

(useStore) instance of useStore with added middleware

Example

import { useStoreWithMiddleware, logger } from '@weser/state'

const useStore = useStoreWithMiddleware([logger()])
On this page