There is no practical difference.
An arrow allows to skip return
keyword, but cannot benefit from hoisting. This results in less verbose output with ES6 target but more verbose output when transpiled to ES5 , because a function is assigned to a variable:
var MyMainComponent = function MyMainComponent() {
return React.createElement(
"main",
null,
React.createElement("h1", null, "Welcome to my app")
);
};
The overhead is 6 bytes in minified and not gzipped JS file, this consideration can be generally ignored.
Verbosity is not necessarily the case when an arrow is exported, due to optimizations:
var MyMainComponent = (exports.MyMainComponent = function MyMainComponent() {
return React.createElement(
"main",
null,
React.createElement("h1", null, "Welcome to my app")
);
});