Skip to content

How initialize context for a machine created with createActorContext ? #4784

Answered by davidkpiano
noliiva asked this question in Q&A
Discussion options

You must be logged in to vote

It should look like this:

const MyContext = createActorContext(myMachine);

function App() {
  return (
    <MyContext.Provider
      logic={myMachine}
      options={{
        input: { myValue: 'initialValue' }
      }}
    >
      <MyComponent />
    </MyContext.Provider>
  );
}

Let me know if this works for you! I'll update the docs soon.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@noliiva
Comment options

Answer selected by noliiva
Comment options

You must be logged in to vote
1 reply
@stevegg
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants