WebCu / gatsby-material-kit-react

Adapt Material Kit React to Gatsby
MIT License
84 stars 36 forks source link

Wrong File-Extensions - jsx #23

Open xstable opened 4 years ago

xstable commented 4 years ago

Is there a reason, why you have choose the jsx File-Extension, for all JS-Files in your Project? Even the material-kit, which you've forked from don't use jsx-filetype at all.

I suggest to better use JSX only for files, which really have JSX-Syntax inside. Else it make no sense... but best choise is to not use jsx-extension at all and stay with the general .js-fileextension.

See here, facebooks recommendadion: https://github.com/facebook/create-react-app/issues/87#issuecomment-234627904

If you wan't to change this fast and easy, you could do it with this small bash-script:

for x in *.jsx; do mv "$x" "${x%.jx}.js"; done
WebCu commented 4 years ago

Thanks @xstable for the info! I'll take a look to this and come back to you asap.

xstable commented 4 years ago

Nice, thanks. BTW, you don't need to add file-extensions if you import a file:

import GridItem from "components/Grid/GridItem.jsx";
import Button from "components/CustomButtons/Button.jsx";
import Parallax from "components/Parallax/Parallax.jsx";

better do it like this:

import GridItem from "components/Grid/GridItem";
import Button from "components/CustomButtons/Button";
import Parallax from "components/Parallax/Parallax";