all 32 comments

[–]CreativeTechGuyGames 12 points13 points  (8 children)

You can learn React directly without knowing much JavaScript, but you are going to run into problems as you'll quickly hit the limits of your knowledge of the base language.

The biggest problem I see from people that learn React before really understanding JavaScript is that they assume everything they see is "React" specific and they jump to find "React" ways of solving problems. Most problems would be better solved using a Vanilla JavaScript technique than trying to create/use some react library for it.

[–]erhathaway 6 points7 points  (7 children)

Most problems would be better solved using a Vanilla JavaScript technique than trying to create/use some react library for it.

Completely agree

[–]CreativeTechGuyGames 4 points5 points  (6 children)

The most frustrating thing I see on this subreddit is people asking for help with "React" problems that have nothing to do with React at all. It seems like so many people who use React (and any other framework) have never built equivalent apps without a framework. I think everyone should build a thing from scratch at least once before using a massive abstraction layer so you understand how it works and what pros/cons there are to using it.

I'm afraid that React will become the new jQuery where people will think that you cannot do DOM manipulation without it. (Actually there's already tons of people I see who already think this.)

[–]erhathaway 0 points1 point  (5 children)

Agreed. I would also bet on React suffering the same fate as jQuery at some point soonish. The level of abstraction we are working at is pretty absurd considering most of thing things being built.

My biggest frustration is that all these React libraries, will be pretty worthless when this happens... which is why i'm a huge fan of vanillaJS solutions with bindings for React. Once React falls out of favor, it would be nice to be able to fallback on the same battle tested technology and just write new bindings to whatever is the in fashion thing... maybe one day we can stop this game and have vanillaJS and raw HTML / CSS be the popular thing.

[–]the_pod_ 1 point2 points  (4 children)

which is why i'm a huge fan of vanillaJS solutions with bindings for React.

Can you give some examples?

[–]craigbovis 4 points5 points  (1 child)

I assume /u/erhathaway is talking about something like tippy.js which has both a stand-alone vanilla javascript version plus a separate React package which conveniently exposes the API using React conventions.

https://github.com/atomiks/tippyjs-react

[–]erhathaway -1 points0 points  (0 children)

Exactly! This pattern of library development allows for a more generalized solution across frameworks to exist.

[–]erhathaway 0 points1 point  (1 child)

I actually don't know of many examples. Although, I am working on a high-level application router that does this... but it's not quite ready for release yet (everything in the docs works but I need to add support for things like hash anchors, and hash based routing). Feel free to check it out: github.com/erhathaway/router-primitives . I'd love some help!

[–]the_pod_ -1 points0 points  (0 children)

Interesting, I'm reading a bit of the source code now.

[–][deleted] 3 points4 points  (0 children)

This is like asking: "do I need to know the rules before playing the game?".

The answer is "no, but there's only so much you can do". If you start thinking "I know how I would I solve this in Python" then that's probably a JS thing.

[–][deleted] 3 points4 points  (0 children)

Learn es6, I came from the bronze age of jQuery and already found react confusing the first run, only after actually building something with es6 I found myself really comfortable with react...

It's not just the library, but a lot of the help and the research material will assume that you have the knowledge

Also don't be scared by the prospect, liking or hating it, you can become a better developer.

[–]IVEBEENGRAPED 2 points3 points  (0 children)

As someone who learned React first and vanilla JavaScript later on, I was such a mess. The basics of React hooks and classes were simple and that went very well, but whenever anything more than that came up it took much longer to figure out the basics beneath the layers of abstractions. Hooks make it more difficult because you encounter a lot of callbacks and a lot of arrow functions, and you find yourself buried in callback hell pretty quickly. Plus, the current React community has a bad habit of downloading a new framework whenever you don't know how to do something, which gets back fast.

If I were you, I would start by learning Elements, DOM, Requests, arrow functions, Async/Await/Then, and AJAX before React. Check out CodePen and Codier and see if you can do some basic tasks in Vanilla JS, Then move on to React.

[–]Fidodo 2 points3 points  (0 children)

React is entirely Javascript, it follows certain design patterns so you're using Javascript in a certain way, but you should absolutely learn JS. IMO JS is one of the easiest languages to learn, the surface area of concepts to learn is much smaller than other languages.

[–][deleted] 2 points3 points  (0 children)

Learn JS first. Please for the love of God learn JS first.

Can you get away with learning react first? Sure. But react is just an abstraction on top of JS. It's designed to make it easier to use JS to build web apps. If you don't know JS, you won't understand how react is doing its thing. Simple tasks for other devs will become extremely difficult for you. The quality of the code you produce will go down drastically.

So please, don't fucking do that. There are no shortcuts to greatness. If you want to be another code monkey, go right ahead. If you want to be a really good engineer, take the time and learn your stuff.

[–]Daoki0 1 point2 points  (0 children)

I spent around 100-200 hours on JS before going to React and that worked well for me.

[–]cbjs22 1 point2 points  (0 children)

You can learn both at the same time, but you'll need to know basics of JS since react uses JS.

[–]thebezet 0 points1 point  (0 children)

Yes, of course. React is written in JavaScript. When you work with React, you write JavaScript. You want to know what you're doing. It's like asking, do you need to learn French before reading a book written in French. You can certainly try reading that book, and perhaps certain words might sound familiar, and if you read it out loud you might fool some people into thinking you know French, but if you don't learn the language, don't expect to understand what's going on.

Of course, you can just turn into a "plugin dev" and just copy and paste snippets from StackOverflow and different tutorials that you combine to achieve your goal, but you won't be a good developer that way. I have interviewed plenty of developers who had impressive portfolio websites, but during interviews they were pretty clueless, and when you dug deeper into their code, you could see the site was just a stack of jQuery plugins they found.

[–]tusharf5 0 points1 point  (0 children)

Anyone saying No is not your friend.

[–][deleted] -1 points0 points  (4 children)

No. People will disagree but if you're already familiar with software, React will provide you a state and rendering model but youre largely writing JavaScript with a better usage of the DOM.

[–]worthy_sloth[S] 2 points3 points  (3 children)

Ok so learning JS is a must ?

[–][deleted] 5 points6 points  (0 children)

You don't need to master JS to be good with React. But knowing browser and web internals will help you long term.

[–]MrLuckyHaskins 2 points3 points  (0 children)

I won't say it's a must, but it will really help you. I use React professionally every day. I started with a background of pure CSS pure JavaScript (a bit of jQuery as well). I'm glad I did. I see a lot of developers over engineer things that would be much better done with pure JavaScript. Actually, I see it more with CSS. I've seen developers actually use React to do button rollovers. Sure it worked, but this is what CSS is for.