Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

how to solve the onClick problem in typescript Reactjs

$
0
0

my function is like this:

async function handleFavorites(event: MouseEvent) { event.preventDefault();}

on my button, I'm using onclick to call this function but it's not working

<button type="submit" value={favorites} onChange={e => setFavorites(e.currentTarget.value)} onClick={() => {    handleFavorites(); }}>

Error: Expected 1 arguments, but got 0.An argument for 'event' was not provided.

does anyone know how to solve? or have any tips?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>