Skip to content
Compare
Choose a tag to compare
@github-actions github-actions released this 07 Feb 16:45
· 179 commits to main since this release
91549ce

Patch Changes

  • #4731 960cdcbcb Thanks @davidkpiano! - You can now import getInitialSnapshot(…) from xstate directly, which is useful for getting a mock of the initial snapshot when interacting with machines (or other actor logic) without createActor(…):

    import { getInitialSnapshot } from 'xstate';
    import { someMachine } from './someMachine';
    
    // Returns the initial snapshot (state) of the machine
    const initialSnapshot = getInitialSnapshot(
      someMachine,
      { name: 'Mateusz' } // optional input
    );