Live data from Hacker News

Things every React.js beginner should know

camjackson.net

61–70 of 247 posts

Re: Things every React.js beginner should know

#61

Earlier quoted context omitted.

The big reason I remember from my PHP days (late 90s early 2000s) is that you want to separate design from development. Graphic designers were expected to know HTML/CSS while developers focus on PHP.

That's never really been true. Graphic designers rarely knew HTML/CSS in the old days.

I remember this well. Especially when it came to browser compatibility.

Re: Things every React.js beginner should know

#62
post #55

Earlier quoted context omitted.

In all fairness this is ancient history on the PHP world.

That's the point that pkrumins/andreyvit are making, code where logic and presentation are mixed turn into a nightmare to maintain. And the practice is now ancient history. Apart from here it is again...

I explicitly do _not_ state that it applies to React, because there's no domain logic in React components. (Or at least there shouldn't be. It is certainly possible to write a spaghetti component that would do everything.)

Re: Things every React.js beginner should know

#63

Earlier quoted context omitted.

Isn't that because it's really JSX? https://facebook.github.io/react/docs/jsx-in-depth.html [NB Not that I know, just checking my own understanding].

I hadn't heard about JSX before so I went to your link to check it out. This is just one of the most off-putting introductory statements I've ever read: JSX is a JavaScript syntax extension that looks similar to XML. Don't we all hate XML? How can you possibly even go on reading about this technology further if it's introduced like that.

XML is still used as a the standard for building layouts - on the web and on Android, and probably many other places. It can be much more readable than code for nesting components.

I believe people hating XML has more to do with using XML as a data transfer format, right? I'm happy using XML for Android layouts but can't imagine using it as a replacement for JSON - which I think is where most of the hate comes from.

Re: Things every React.js beginner should know

#64
post #24

I'm not a React or Angular expert, but do you really put HTML inside of your JS code? It just bothers me too much. We spent years in early web days learning that code and templates should be separate, yet here we are putting HTML inside of code, which goes against years of practice. Can anyone share their professional thoughts about this?

Putting HTML and JS in different files doesn't make them separated. They are still bound by logic. It's an imaginary separation with obscure dependencies. I very much prefer the React way of bundling things that in reality belong together.

It is quite possible to develop semantic, content focused HTML and then at a later point style and re-style with CSS.

It is only through laziness and lack of understanding that people couple them together.

Re: Things every React.js beginner should know

#65

Earlier quoted context omitted.

Hey, thanks for this. With regards to redux-thunk, have you taken a look at redux-saga[0]? Any thoughts? [0] https://github.com/yelouafi/redux-saga

I've seen it mentioned by a few people, including Redux creator Dan Abramov (who is very open about tweeting links to 'competing' libraries!), but I've only taken a brief look so far. My initial impression is that it seems really interesting, although I wonder if the use of generators will scare people away. Many devs are already exhausted with the number of new JavaScript features they're being told to learn. I defi…

Best comparison I've seen so far is that it's sort of like "background processing threads for Redux". The downside is that it might not mix well with time-travel debugging, because a saga effectively has its own internal state.

That said, Dan Abramov does seem to think it's a very intriguing approach, so it's worth keeping an eye on.

Re: Things every React.js beginner should know

#66

Earlier quoted context omitted.

I hadn't heard about JSX before so I went to your link to check it out. This is just one of the most off-putting introductory statements I've ever read: JSX is a JavaScript syntax extension that looks similar to XML. Don't we all hate XML? How can you possibly even go on reading about this technology further if it's introduced like that.

XML is still used as a the standard for building layouts - on the web and on Android, and probably many other places. It can be much more readable than code for nesting components. I believe people hating XML has more to do with using XML as a data transfer format, right? I'm happy using XML for Android layouts but can't imagine using it as a replacement for JSON - which I think is where most of the hate comes from.

Good point - Now that you said that, I don't mind using XML for defining UIs but I absolutely hate to use for data transfer.

Re: Things every React.js beginner should know

#67

Earlier quoted context omitted.

Isn't that because it's really JSX? https://facebook.github.io/react/docs/jsx-in-depth.html [NB Not that I know, just checking my own understanding].

I hadn't heard about JSX before so I went to your link to check it out. This is just one of the most off-putting introductory statements I've ever read: JSX is a JavaScript syntax extension that looks similar to XML. Don't we all hate XML? How can you possibly even go on reading about this technology further if it's introduced like that.

XML is fine. XHTML is XML, after all. The issues with XML are the kind of XML that is often created with it, with namespace nightmares, endless embedded tags, etc. etc.

But if you're using XML to basically make a variant of HTML, it's great.

Re: Things every React.js beginner should know

#68

Earlier quoted context omitted.

Isn't that because it's really JSX? https://facebook.github.io/react/docs/jsx-in-depth.html [NB Not that I know, just checking my own understanding].

JSX is a HTML-like template language that gets preprocessed to actual HTML.

No it's not getting preprocessed to actual HTML in React. Depending on the transform function, it can be turned to an object tree or a function calls tree (like in React) or actually HTML like you said but it's not a common use case AFAIK.

It's not a text templating language like classic PHP, it's an object/function calls hierarchy DSL (more like vb.net XML literals). I think most people critisizing react for putting html in JS havn't tried it or don't remember why "html" in code was considered bad in the first place.

Re: Things every React.js beginner should know

#69

I'm not a React or Angular expert, but do you really put HTML inside of your JS code? It just bothers me too much. We spent years in early web days learning that code and templates should be separate, yet here we are putting HTML inside of code, which goes against years of practice. Can anyone share their professional thoughts about this?

I thought the same. Then I tried it.

It does result in a tight coupling of template and code, but I'm yet to see a downside to that. Separating template and logic has been the dream forever but is never realised in any non-simple project. Embracing that coupling has been great for me.

Re: Things every React.js beginner should know

#70
post #67

Earlier quoted context omitted.

I hadn't heard about JSX before so I went to your link to check it out. This is just one of the most off-putting introductory statements I've ever read: JSX is a JavaScript syntax extension that looks similar to XML. Don't we all hate XML? How can you possibly even go on reading about this technology further if it's introduced like that.

XML is fine. XHTML is XML, after all. The issues with XML are the kind of XML that is often created with it, with namespace nightmares, endless embedded tags, etc. etc. But if you're using XML to basically make a variant of HTML, it's great.

They should've said:

    JSX is a JavaScript syntax extension that looks similar to HTML.
Post reply on HN