How to use the xstate.State function in xstate

To help you get started, we’ve selected a few xstate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MicheleBertoli / react-automata / test / withStateMachine.spec.js View on Github external
test('props', () => {
  const Component = () =&gt; <div>
  const StateMachine = withStateMachine(statechart)(Component)
  const machineState = new State('b')
  const renderer = TestRenderer.create(
    
  )
  const instance = renderer.getInstance()
  const component = renderer.root.findByType(Component)

  expect(component.props.foo).toBe('bar')
  expect(instance.state.machineState.value).toBe('b')
})
</div>