Skip to content

Can I call functions of component from parent? #148

Answered by sqllyw
sqllyw asked this question in Q&A
Discussion options

You must be logged in to vote

I think, a global state like this:

const counter = reactive({
            count: 0,
            inc() {
                this.count++
            }

        })

then I can have:

createApp({
        counter,
        main_inc() {
            console.log('main click')
            counter.inc()
        }
    }).mount()

Replies: 3 comments

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
0 replies
Answer selected by sqllyw
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