Skip to content

Instantly share code, notes, and snippets.

View lithin's full-sized avatar

Anna McLeod lithin

View GitHub Profile
@lithin
lithin / state-machine.js
Created May 30, 2019 15:33
Example of react state machine with hooks
// @flow
import * as React from 'react';
import { Machine, interpret } from 'xstate';
import { Discovery } from '~/screens/install-devices/discovery';
import { GetStarted } from '~/screens/install-devices/get-started';
import { RenameDevice } from '~/screens/install-devices/rename-device';
import { mapping, type Props as ConnectorProps } from '~/core/domains/installation/devices/mappings';
import { hiveNavigate } from '~/navigation';
@lithin
lithin / machine.js
Last active June 17, 2019 16:20
State machine discovering devices
const states = {
DISCOVERY: 'DISCOVERY',
GET_STARTED: 'GET_STARTED',
RENAME: 'RENAME',
TIMEOUT: 'TIMEOUT',
DONE: 'DONE',
ERROR: 'ERROR',
};