Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
–
–
–
–
–
As explained by Nicholas Tower in this answer
Typescript | Warning about Missing Return Type of function, ESLint
, depending on the react version that you are using, you can use any of the lines below:
If you're on the latest react version (16.8.0 or later), do this:
const Component: React.FunctionComponent<Props> = (props: Props) => { }
Prior to 16.8, you'd instead do:
const Component: React.SFC<Props> = (props: Props) => {}
Where SFC stands for "stateless functional component".
EDIT:------
Based on @SergioP's comment, a more idiomatic solution would be
const Test = ({ title }: Props): JSX.Element => <div>{title}</div>
–
–
The above code given same issue to me, then code is updated like below, then error disappear in my case
const handleLogout = (): void => {
router.push('/')
Reference Link:
https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/explicit-function-return-type.md
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.