0.0.2 • Published 6 years ago

storybook-addon-xstate v0.0.2

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

xstate-addon

A storybook addon project for xstate (https://github.com/davidkpiano/xstate)

The project is in an early stage. Everyone who is interested in bringing this project forward is welcome to contribute ideas, docs and code.

install

!! storybook version: 3.3.0 !!

npm i storybook-addon-xstate -D

register

addons.js

import 'storybook-addon-xstate/register';

story

import { WithXStateGraph } from 'storybook-addon-xstate';

<WithXStateGraph
   machine={xstateMachine}
   onTransition={onEvent}
   currentState={currentState}
>
  <TrafficLight light={currentState} />
 </WithXStateGraph>

basic idea

Basic Idea