Xstate Svelte screenshot

Xstate Svelte

Author Avatar Theme by Distolma
Updated: 28 Mar 2021
40 Stars

XState tools for Svelte

Overview

The XState-Svelte package is deprecated and users are encouraged to use the official @xstate/svelte package instead. XState is a library that allows for the creation, interpretation, and execution of finite state machines and statecharts, as well as managing invocations of those machines as actors. The XState-Svelte package was created to simplify interactions with XState in Svelte applications.

Features

  • useMachine(machine, options?): A function that interprets the given machine and starts a service that runs for the lifetime of the component.
  • useService(service): A function that subscribes to state changes from an existing service.
  • useMachine(machine, options?) with @xstate/fsm: A special useMachine hook that interprets the given finite state machine from @xstate/fsm and starts a service that runs for the lifetime of the component.

Installation

To use the XState-Svelte package, you can install it via npm by running the following command:

npm install xstate-svelte

After installing the package, you can import and use the provided functions in your Svelte application.

Summary

The XState-Svelte package is a deprecated package that was created to simplify interactions with XState in Svelte applications. It provides functions like useMachine and useService to work with state machines and statecharts. However, users are encouraged to use the official @xstate/svelte package instead.