Skip to content

React specific fragment syntax causes linter warning #6389

@haf

Description

@haf

Copied from #5950 which was closed for some archaic reason.

I have this component
import React from 'react'

export default ({ name, age }) => (
	<>
		{name} - {age}
	</>
)

I got warning of Line 1: 'React' is defined but never used no-unused-vars in my terminal. I changed the <></> to div, the error is gone. Is this a bug?

I'm using "react": "^16.6.3"

I, myself, just pulled in the very latest create-react-app, so it's not specific to the above version (mine is 16.8.1)

image

image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions