1.0.0-rc.1 • Published 3 years ago

jsxstate v1.0.0-rc.1

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

Declarative UIs for declarative XState machines

NPM JavaScript Style Guide Travis


jsxstate - Motivation

The main idea of the library is to provide an easy way to write React UIs based on XState machines using components only (or mainly). Instead of writing imperactive coding, creating functions to trigger events or creating complex hooks, you can focus in writing components that communicate with your machine, render desired data when a machine state matches and stuffs like that.


Playground

Try it out on the playground - https://marceloadsj.github.io/jsxstate/


Install

npm install jsxstate
# or
yarn add jsxstate

Peer dependencies: react xstate @xstate/react


APIs

You can find each API individually below:

Interpret - How to start a machine and provide it on React context

Value - How to render the finite or infinite state of a machine

Send - How to trigger events on a machine

Matches - How to render components based on a finite or infinite state

Hooks:

useContextMachine - How to access the machines on the context

useMatches - How to get booleans based on finite or infinite state

useSend - How to get triggers to send events to the machine

useValue - How to access machine finite or infinite states

Internals

Those are not exported, but you can read how they works under the hood

MachineContext - How React context works inside the library


Roadmap

Version 1

  • Simple playground with editor and real time result
  • Basic components (Interpret, Value, Send, Matches)
  • Tests for all components
  • Documentation for all components
  • Targeting machines by configurable id/machineId on components
  • Basic hooks (useContextMachine, useValue, useSend, useMatches)
  • Tests for all hooks
  • Documentation for all hooks
  • Targeting machines by configurable id/machineId on hooks
  • Everything written in Typescript (appart of the example/playground)

License

MIT © marceloadsj

1.0.0-rc.1

3 years ago

1.0.0-beta.7

4 years ago

1.0.0-beta.6

4 years ago

1.0.0-beta.5

4 years ago

1.0.0-beta.3

4 years ago

1.0.0-beta.4

4 years ago

1.0.0-beta.2

4 years ago

1.0.0-beta.1

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago