0.1.0-alpha.3 • Published 1 year ago

@simple-state-machine/react v0.1.0-alpha.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react

Installation

    npm i @simple-state-machine/core @simple-state-machine/react

Quick Glance

    import {useMachine} from '@simple-state-machine/react'
    import ThemeMachine from './theme-machine';

    function Theme({children}){
        const {state, send} = useMachine(ThemeMachine)
        const themeClassName = state.value === 'light' ? 'light-mode' : 'dark-mode'
        const toggleTheme = () => send('TOGGLE');

        return (
            <>
                <button onClick={toggleTheme}>Toggle Theme</button>
                <div className={themeClassName}>
                    {children}
                </div>
            </>
        )
    }

API

  • If you are new to simple-state-machine, it is recommended to go through the core package
  • In order to understand the API in depth, please go through the api-documentation

Examples

Tutorial

0.1.0-alpha.3

1 year ago

0.1.0-alpha.2

1 year ago

0.1.0-alpha.1

1 year ago

0.1.0-alpha.0

1 year ago

0.0.24

2 years ago

0.0.23

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago