Skip to content
Version: xstate@5.0.0

createActor() function​

Creates a new ActorRef instance for the given machine with the provided options, if any.

Signature:

export declare function createActor<TMachine extends AnyStateMachine>(machine: AreAllImplementationsAssumedToBeProvided<TMachine['__TResolvedTypesMeta']> extends true ? TMachine : MissingImplementationsError<TMachine['__TResolvedTypesMeta']>, options?: ActorOptions<TMachine>): Actor<TMachine>;

Parameters​

ParameterTypeDescription
machineAreAllImplementationsAssumedToBeProvided<TMachine['__TResolvedTypesMeta']> extends true ? TMachine : MissingImplementationsError<TMachine['__TResolvedTypesMeta']>The machine to create an actor from
optionsActorOptions<TMachine>(Optional) ActorRef options

Returns:

Actor<TMachine>