...since nothing in that file should be accessing that 'MyComponent' except the export.
Also that react import is very confusing though. Why do I need it?
I don't reference that variable anywhere... oh wait some tool compiles the JSX for me at some point into React.createElement
or whatever. Very opaque:
import React from 'react';
const MyComponent = () => (
<div>Hello!</div>
);
export default MyComponent;
import React from 'react';
export default MyComponent = () => (
<div>Hello!</div>
);
...But eslint doesn't complain about error Expected a function declaration func-style
export default Function MyComponent () {
return (
<div>Hello!</div>
);
};
...but I don't really need any prop access or whatever:
import React, {Component} from 'react';
export default class MyComponent extends Component {
render() {
return (
<div>Hello!</div>
);
}
};