Created
July 9, 2021 12:03
-
-
Save bryanwb/4c24a0b7575ed2e04bb2392213c6a0e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const machine = createMachine(/* details elided */); | |
const Component1 = () => { | |
const [state, send] = useMachine(machine); | |
setInterval(() => send({type: 'LOGIN', password: 'foobar'}), 500 | |
return null; | |
} | |
const Component1 = () => { | |
const [state, send] = useMachine(machine); | |
// will this have the password foobar? | |
return <div>{state.context.password}</div>; | |
} | |
const App = () => { | |
return ( | |
<div> | |
<Component1 /> | |
<Component2 /> | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment