-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Generate even less code? #642
Comments
Of these files, we could technically not include |
Granted, I'm not the target audience, and I haven't actually used it CRA yet, but that seems like the right amount of startup to me. One small example of everything, just enough to show how it's done and give you something to work from. |
Hey, so to chime in here rather than one twitter (and the 140 character limit!). The direction I was coming from was very much: I WANT TO CODE NOW. i.e. don't want tests, don't want packages, just want results (and errors). I'm not sure this is quite right for the masses…the fact you've got a test template in your initial build is good (really good). It's likely the next step I'm going to take when looking at my code. But, just to give you my input on these files (and don't take this input as "this is what should be changed"!):
(Take the comments as light hearted please ❤) Aside: I might remove the emphasis on the "way" too much code. In hind sight, I ran a few generators (and included C-R-A) but briefly looked at the tree output and quickly tossed it aside as I was after the index HTML + JS. |
We wanted to make it clear you can delete everything except Tangentially, this is the kind of thing CRA would've solved for you: |
I'm a react beginner and imo create-react-app has the perfect amount of On Wednesday, 14 September 2016, Dan Abramov [email protected]
Best Regards, Huy Do P: (02) 8215 0661 |
maybe adding a single parameter to create-react-app eg. "create-react-app minimal" to generate an app with the most minimal amount of files possible. But i understand that is a slippery slope considering this is a "no config" tool, and it can easily set a precedent for adding more parameters etc. and we have configuration all over again. |
A few ideas on how to reduce files: Remove Remove Remove |
Everyones opinions here is to remove certain things, but I think they are all useful and serve a purpose. It's easy for beginners to remove things they don't need, but hard to know how to add things they do need that they haven't done before. |
Instead of removing useful files, would it help if the README started off with a better "React beginner" path? Save the parts about how to make full use of this project to build tested production apps for further down in the file, and just get right into making your own basic components in App.js. This solution assumes that many files are thought of as bad because it makes the project look complicated, and that we in very few words can explain that it is not. 😃 create-react-app has completely changed how I introduce new people to React, and we go directly to coding in the If create-react-app is not a person's first experience with a generator or starter project, chances are it can be perceived as more complex than it is, but maybe a quick guide to build something trivial from scratch, throwing away the component code in App.js will show that it really is as simple as running create-react-app and start coding, and that there are no magic parts to create-react-app you need to understand first (unlike most starter-projects). |
I don't think it's too much for a beginner, I just started last week and i'm glad create-react-app abstracted the setup process. In reply to @mlrawlings about testing. I think we should leave it in. Testing is fundamental for a modern web application and i think leaving it in sets people on the right track. The lower the barrier of entry to testing the better. |
Maybe I'm off base here, but to me it sounds like @remy didn't want to create a React app, he wanted to play around with React to get an understanding it, the library in and of it self. Not how you build a production ready application with React. Although for many people those two things overlap, in this case it seems like it didn't and that something more barebones, other than Create-React-App, perhaps some kind of playground would have been more suitable? I'm basing this of wanting no cross-browser support, no styles, no tests, having client-side jsx transforms, etc. The beauty with Create-React-App is that it will give you all those nice things and more, it just happens to be that those things were of no interest to @remy in this case. @remy Please forgive me if misrepresented/misinterpreted you in anyway. @gaearon I love that you care so much, but please remember that you cannot make everyone happy, because not everyone wants or needs the same things. but that you've helped and inspired a tremendous amount of people with your work :) |
Yeah - I get the impression that a REPL like JSFiddle, JSBin, or WebpackBin would have been more relevant for the kind of "I just want to write some code and see what happens" goal that @remy seemed to be expressing. |
@hummlas no, I think you're on point with your comments, and I was waiting for the discussion to settle a bit before coming back in. I think it's important to keep in mind who CRA is for. My comments (in my blog) might be useful, it might not be. My sense is that CRA is for beginners on their journey to learning React. I was approaching it exactly as @markerikson suggests, very close to a REPL, and wanting to see the effect of change quickly. Thinking now, the way to tackle this kind of audience might actually just be in the README me, somewhere clearly stating "if you just want to try it out, try this …". I found gist fascinating, it got me React with JSX in two files and it all just worked (obviously I looked under the hood and I was pulling 2mb of script, but that's fine for a bit of dabbling). I hope that helps a little! |
I think it would be better to start out with a well-accepted directory structure than a totally flat unstructured code base. Something is always better than nothing imo. People follows different methodology but the one I found many other professional and myself using looks somewhat like this:
|
I'll throw in my $0.02. Just this discussion alone is a reason to like CRA :).
When I looked into the src-directory for the first time, the difference between Maybe
@louisgv: I understand your reasoning but let's not make it even more complicated by adding more paths and directories. It's so refreshing to start small... and many projects also stay there. For the big important ones creating the structure You want isn't going to be a biggie. Another slightly related thing. On a decent server it takes "create-react-app test" 1+ minute to finish... that's a pretty long time when you wanna get going. Admittedly it's a one-shot thing. |
Who is this mysterious "beginner"? Someone who just started coding or someone who is moving from another framework? Answer to this question changes the answer to this issue drastically. If we are targeting the absolute beginner, then:
|
@ippa lol i agree on that README, however for the styles its great to have both of them. Letting people know well index is where your global styles go, and then the App.css showing the convention for how to add component styles |
I agree with @AlicanC. If you're going to say "beginners", please define the word. It could mean:
And many more. IMO anyone who has done JS in the past year or so or even less has used |
Thanks for feedback, everyone! Closing as for now I think all parts are relatively essential. We split |
i'm glad to see that you DIDN'T remove the README.md. When starting out I tried out a gazilion boilerplate options. This is the one I liked the most, and without the README file, it would have been hard to remember that it was actually a CRA installation. Good job! |
Is it possible to change the javascript entry point from ./src/index.js to some other folder like ./components/header/common/index.js in create-react-app |
No, it's not possible. |
From @remy’s amazing First Impressions of React, this paragraph made me sad:
Is there anything we could do to better match your use case? These are the files we generate by default. We opted for a bare minimum, just enough to render a single component.
Here’s what we generate:
Should we cut something?
The text was updated successfully, but these errors were encountered: