Major Changes
-
#5512
063416dThanks @davidkpiano! - Modernize Store v4 package entrypoints.Use framework-specific packages such as
@xstate/store-reactand@xstate/store-solidinstead of@xstate/store/reactor@xstate/store/solid. The Store packages now publish ESM package entrypoints. -
#5512
063416dThanks @davidkpiano! - AddcreateStoreLogic(...)for reusable store definitions, and support creating stores from logic in framework hooks.const counterLogic = createStoreLogic({ context: (input: { initialCount: number }) => ({ count: input.initialCount }), on: { inc: (context) => ({ count: context.count + 1 }) } }); const store = useStore(counterLogic, { initialCount: 0 });
If a store logic requires input, the input argument is also required:
useStore(counterLogic, { initialCount: 0 });
Framework hooks also preserve schema-derived context, event, and emitted event types when creating stores from config objects.