Difference between Actor and ActorRef #4909
-
I am a little puzzled with difference between these two. Especially looking into import { createActor } from 'xstate';
function useActorRef(...): ActorRef {
const actorRef = createActor(...); // type is `Actor`
return actorRef as any; // type becomes `ActorRef`
} What are the differences, and why can’t they be used interchangeably? |
Beta Was this translation helpful? Give feedback.
Answered by
davidkpiano
May 24, 2024
Replies: 1 comment 3 replies
-
For most intents and purposes, the two should be able to be used interchangeably. In short, Can you share code where this is not working as expected? |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
alexamy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For most intents and purposes, the two should be able to be used interchangeably. In short,
Actor
implementsActorRef
but has a few extra methods.Can you share code where this is not working as expected?