Decouple UI from Actor Hooks #5113
Unanswered
tnortman-jabra
asked this question in
Q&A
Replies: 2 comments
-
Example
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Now, we have
and how we might genericize the screen component:
But it feels like there is a better way I am not seeing |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Stack
React Native
React Navigation
XState v5
Scenario
You have a series of screens
ScreenA
,ScreenB
,ScreenC
, ...ScreenN
and so onAll screens are under an
ActorContext
(they are usinguseActorRef()
anduseSelector
)The flow of screens is driven by an XState machine,
FlowMachine
Screens have buttons which send events to the
FlowMachine
.The
FlowMachine
reacts to these user driven events and moves the user through the flowNow. Imagine we have a new flow; we create
AnotherFlowMachine
. We want to reuse some of the same screensScreenA
,ScreenB
, and so onIssue
The
ScreenX
are using a hookuseActorRef
which is tied to theFlowMachine
. It's very nice for type safety.How might you go about:
Beta Was this translation helpful? Give feedback.
All reactions