Skip to content

Access the context variable from a inner state's action #5115

Answered by crishoj
nguyenlam185 asked this question in Q&A
Discussion options

You must be logged in to vote

As I understand, context is shared.

From the looks of it, the issue could be that assign is not being returned from the scope:

    states: {
        active: {
            entry: () => { // 👈 The curly braces here result in nothing being returned by this closure
                assign({
                    count: 10
                });
            },
            after: {
                '1000': [{
                    target: 'inactive'
                }]
            }
        },

Perhaps the version below would work?

    states: {
        active: {
            entry: assign({
                count: 10
            }),
            after: {
                '1000': [{
                    target: 

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@nguyenlam185
Comment options

@crishoj
Comment options

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