Skip to content

When using typescript template CRA does not lint correctly #11280

@lobaak

Description

@lobaak

When using the typescript template with the following example no react/jsx-key error is displayed on the div in the loop.

const list = [
  { id: 1, title: "test" },
  { id: 2, title: "test" },
];

function App() {
  return (
    <div className="App">
      {list.map((item) => (
        // No linting error here for missing key
        <div>{item.title}</div>
      ))}
    </div>
  );
}

export default App;

Is this intended or is it something to do with Typescript? I noticed there is an error if I use plain JS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions