Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File structure #71

Closed
Gusted opened this issue Jun 6, 2021 · 7 comments
Closed

File structure #71

Gusted opened this issue Jun 6, 2021 · 7 comments

Comments

@Gusted
Copy link
Contributor

Gusted commented Jun 6, 2021

Now everyone has their own taste about how to structure files, however at this moment I see 2 problems.

  • First letter capitalized or not? I see certain files not being capitalized at this moment should they be capitalized or should the others files not being capitalized as first letter?
  • File suffix, we are working here with JSX syntax however are naming the files as .js files, I think they should be renamed to the correct file extension -> .jsx
@drcmda
Copy link
Member

drcmda commented Jun 6, 2021

i think its quite common. components captitalized, everything else lowercase. index.js. Minimap.js <Minimap />. i have never seen anyone use *.jsx before, didn't even know it existed. i think it's perfect as it is now, same as the default react startup https://codesandbox.io/s/elated-stonebraker-f7ci1 or cra

everything either lower or uppercase and .jsx seems not so common to me, at least none of the clis do it.

@Gusted
Copy link
Contributor Author

Gusted commented Jun 6, 2021

Hmm okay

@Gusted Gusted closed this as completed Jun 6, 2021
@drcmda
Copy link
Member

drcmda commented Jun 6, 2021

btw i found this: https://reactjs.org/docs/faq-structure.html react ofc is unopinionated but these suggestions are what i see most people using.

@bjornstar
Copy link
Member

Now everyone has their own taste about how to structure files, however at this moment I see 2 problems.

  • First letter capitalized or not? I see certain files not being capitalized at this moment should they be capitalized or should the others files not being capitalized as first letter?
  • File suffix, we are working here with JSX syntax however are naming the files as .js files, I think they should be renamed to the correct file extension -> .jsx

We already had an issue with filename capitalization because git does not pick up capitalization changes by default. Some filesystems are case insensitive and didn't have an issue, while others are case sensitive and the build broke. We can avoid problems with capitalization if we standardize on lowercase.

I also agree that .jsx is the appropriate file extension for files using the jsx syntax. It's nice that the default configuration of create-react-app just makes it work, but we can have better build performance if we specify which files need transpiliation from jsx to js.

@drcmda
Copy link
Member

drcmda commented Jun 7, 2021

if we use jsx, then i think we could move to vite. craco + esbuild is faster than cra, but vite is up without any delay, 0.01ms, also fast refresh is instant. but i think it wants "jsx" which i thought is weird that's why i chose cra initially. @bjornstar @Gusted should we?

@Gusted
Copy link
Contributor Author

Gusted commented Jun 7, 2021

@bjornstar @Gusted should we?

I've heard of Vite and seen it a couple of times being used. It's more tooling than CRA offers at this moment and seems like they already have a template for react however if we for some reason want's to switch to Ts in the future it's better to do it now and use the typescript react template.

Vite overall seems great no issues raised from me. Additionally we could covert this into a discussion, to get some more input.

@bjornstar
Copy link
Member

I don't mind trying vite, using create-react-app is really slow and painful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants