-1

There seems that React can handle both files extension, but is there any real difference on performance?

On my personal experience I haven't notice it. I created very small projects with less than 100 users.

I rather use JSX for components and JS for utilities.

1
  • It's not React that handles them, but rather the browser or your build tooling. And the file extension does mostly not matter. What matter is that the browser cannot execute code with JSX syntax, and that your build tooling might distinguish features based on the file extension. But none of this has anything to do with performance. Commented Oct 1, 2023 at 13:40

1 Answer 1

0

No. .jsx is just an extension to mark that the file uses JSX syntax.

JSX syntax will always get compiled down to regular JavaScript – and indeed, you could write your components in .js files:

function Hello() {
  return React.createElement("div", null, "hello");
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.