Skip to content

quick fix for function only contains one jsx element and have not the return statement #25751

Closed
@Kingwl

Description

@Kingwl

Search Terms

quickfix, jsx, function

Suggestion

quick fix for function only contains one jsx element and have not the return statement

Use Cases

the pattern of a function with block body that only have one jsx element without return statement
that seems a error
could we provide a quickfix for that?

Examples

items.map(x => {
  <div>123</div>
})

to

items.map(x => (
  <div>123</div>
))

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript / JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. new expression-level syntax)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions