Archius Vương
Archius Vương

Reputation: 21

VueJS JSX: How can I listen to a "Click" event on a render function?

I'm currently building a SPA app, and here is my problem:

[Vue warn]: Error in v-on handler: "TypeError: handler.apply is not a function"
    
    found in
    
    ---> <SearchBar> at src/components/SearchBar.vue
           <App> at src/App.vue
             <Root>
    warn @ vue.runtime.esm.js?2b0e:619
    logError @ vue.runtime.esm.js?2b0e:1884
    globalHandleError @ vue.runtime.esm.js?2b0e:1879
    handleError @ vue.runtime.esm.js?2b0e:1839
    invokeWithErrorHandling @ vue.runtime.esm.js?2b0e:1862
    invoker @ vue.runtime.esm.js?2b0e:2179
    original._wrapper @ vue.runtime.esm.js?2b0e:6917
    vue.runtime.esm.js?2b0e:1888 

    TypeError: handler.apply is not a function
            at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1854)
            at HTMLButtonElement.invoker (vue.runtime.esm.js?2b0e:2179)
            at HTMLButtonElement.original._wrapper (vue.runtime.esm.js?2b0e:6917)

I just started my VueJS path so there will be many shortcomings, hope everyone can tell me where I went wrong. Any comments will be appreciated. Many thanks everyone !

Upvotes: 1

Views: 827

Answers (1)

Abbos Tajimov
Abbos Tajimov

Reputation: 1169

you missed callback function in onClick prop

onClick={(event) => {
  // do something
}}

Upvotes: 1

Related Questions