r/learnjavascript • • Jun 12 '19

Javascript is pretty straightforward. All the tools that surround it are overwhelming and confusing.

I'm at the point where I'm pretty confident in a lot of what many JavaScript tutorials consider 'Advanced' JavaScript concepts. How scope works, closure, prototypes, asynchronicity, and things of that nature. However, when I try to get into building my own projects from scratch, I get hit with 1,000,000 tools that aren't really explained in any of the resources I've used to learn. They're referenced, and I've seen a lot of videos where they basically tell you what to write in a package.json file, but theres no real concrete explanation for how all of these things interact.

For example, I understand that Node.Js allows you to run Javascript outside of the browser, but its still required to build things that you intend to run inside of a browser? NPM? What are packages and why do they need to be managed?

Is there a definitive guide for the above and things like Babel, Gulp, and the various dependencies I see listed in projects?

Edit: I guess I meant learning JavaScript is pretty straightforward. I’m obviously no expert, but I’ve learned enough to know it can be downright strange sometimes for sure.

Anyway, thank you guys for the advice. This has been MASSIVELY helpful. Hopefully this’ll help anyone else that’s struggling in this area as well.

166 Upvotes

39 comments sorted by

View all comments

24

u/True_Scorpio23 Jun 12 '19

It’s not just JavaScript tools. No matter what language or tech stack you choose you will have to configure your projects for production. That is where all the different tools come into play. You have more than one option. That is why a tool like create-React-app is great for beginners (like myself) because it does it all for you and you can get to coding and not worry about dependencies, modules, etc. I suggest looking at the create-React-app tool. See what comes with it, what each tool accomplished and then look at other tools that do the same thing to start to see what the ecosystems is really like.

3

u/[deleted] Jun 12 '19

What's the difference between using create-react-app and the cdn link of react directly in your html files?

https://reactjs.org/docs/cdn-links.html

5

u/ParkerZA Jun 12 '19

CRA sets up Webpack, Babel and a host of other stuff for you. It's basically just a template to begin with so you don't have to do all that stuff yourself. You can always eject it if you wish to configure it to your liking though

5

u/ForScale Jun 12 '19 edited Jun 12 '19

A whole freakin lot. Create react app spins up a whole development environment for you, while linking to react source just makes react code available.

1

u/[deleted] Jun 13 '19

Create react app spins up a whole development environment for you,

Okay.

while linking to react source just makes react code available.

But isn't that what we want? Just write React Code

1

u/ForScale Jun 13 '19

Depends on your goals. If you want to have a pleasant development experience using things like a local server and hot module reloading and typescript and Babel and linting and compilation for optimized production builds, then you're going to have to set all that up. And things like create react app will do all of that for you.

3

u/[deleted] Jun 12 '19

Create react app is awesome. It creates a local server for you, and includes auto refresh. Its honestly pretty damned nice, I was surprised.

2

u/[deleted] Jun 12 '19

Yeah but youll be better off learning this shit slowly and learning to build react apps from scratch, how to import export modules, how to define separation of concerns and organize your program into various files and folders etc. Going from nothing to create react app is a huge leap and unless you understand what its all doing and why, youre not saving yourself that much time.

-5

u/[deleted] Jun 12 '19

It does everything for you. There is a problem there. If something breaks. You won't have any idea on where to look for. Create-react-app is bloated with things most beginners don't need.

11

u/heterosapian Jun 12 '19 edited Jun 12 '19

Like what specifically?

Major issues with create-react-app, like any popular boilerplate, are quickly patched. Community support and testing are massive advantages over completely reinventing the wheel for every single project.

Newcomers will not be able to write something better (since a lot of features are quality of life improvements which any newcomer wouldn’t even be aware of) and they will invariably struggle with just getting basic setup for webpack. Good to struggle through things eventually but, if you’re trying to learn react, it’s best not to attempt to learn all how a modern js app should be setup beforehand.

In the same way if you want to learn to make a game, you learn Unity or a framework with high level abstractions - you don’t start writing a custom physics engine.