Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138163

explicit-function-return-type creating functional component react in typescript

$
0
0
const App: FC = () => {
   const addItem = () => {
      useState([...items, {id:1,name:'something'])
   }
   return<div>hello</div>
}

linter gave me error, on my App.tsx.

warning  Missing return type on function  @typescript-eslint/explicit-function-return-type

I have to turn off explicit-function-return-type, how to fix above code? The AddItem doesn't have to return something.


Viewing all articles
Browse latest Browse all 138163

Trending Articles



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