3 ms·
> But React is as much a framework as Angular is. Sure,the difference is React doesnt tell you how to organize your application.AngularJS does,you have to use
by aikah 12y ago
> But React is as much a framework as Angular is.
Sure,the difference is React doesnt tell you how to organize your application.AngularJS does,you have to use dependency injection.I like it,some people dont.
AngularJS is in no way perfect.But compared to other frameworks,Ember,Backbone,... In my opinion it's better.
I personally dont like React because of JSX,I dont want to have to learn a JS superset,and i'll probably wont like AngularJS 2.X because of atscript either,wether it's mandatory or not(understanding exemples on the web will make it mandatory).
- jasim 12y agoYou can use React without JSX. It is especially easy if you are using CoffeeScript which makes the syntax quite terse. I personally like JSX. It is more of a variant of Javascript that lets us mix HTML into JS seamlessly. It was inspired from XHP (https://www.facebook.com/notes/facebook-engineering/xhp-a-new-way-to-write-php/294003943919 https://www.facebook.com/notes/facebook-engineering/xhp-a-ne...), a PHP extension developed and used by Facebook that lets PHP understand XML. I think that the cross-pollination of this idea into React might be one of the best things to have happened to front-end development in the recent past. JSX is different from HTML in a few simple ways (http://facebook.github.io/react/docs/jsx-in-depth.html http://facebook.github.io/react/docs/jsx-in-depth.html): - All HTML attributes are written in lowerCamelCase, like so: contentEditable, maxLength etc. React has a wonderful "is this what you meant?"-style warning system for when we slip-up on these details. More on HTML attributes in JSX is here: http://facebook.github.io/react/docs/tags-and-attributes.html http://facebook.github.io/react/docs/tags-and-attributes.htm... - You can't use `class` to denote CSS class names. It is always `className`. You are going to forget this as you copy-paste a FontAwesome icon definition or Bootstrap snippet into the project and wonder what went wrong. But practice makes perfect. - If you want to write inline styles, the style attribute should be written as a Javascript hash (it is actually a blessing in disguise). React documents it here: http://facebook.github.io/react/tips/inline-styles.html http://facebook.github.io/react/tips/inline-styles.html. I haven't found any other incidental quirks in JSX, and it integrates nicely with Javascript in practice. It is however different from the way things have always been done, which can be a good reason for resistance.
- aikah 12y agoSure,but you need to learn JSX to read code exemples around the web.So you cant really use React without knowing JSX. That's a subtle thing but important enough when you're working on big projects.
- dandelany 12y agoSure, but if you can read HTML and you've read the above list of caveats: congratulations, you can now read JSX. The attributes are simply passed to children as props. There's really not much to it.
- dkersten 12y agoI don't think its a big deal. I use ClojureScirpt and Om, but often read React sample code (sepecially the React-bootstrap snippets). JSX doesn't map to what my ClojureScript code looks like at all, and neither does the pure JS React code, but I don't find it hard to read or understand at all and its fairly easy to learn what I need from it.
- aidos 12y ago"I personally dont like React because of JSX,I dont want to have to learn a JS superset..." What do you gain from that? You don't like it because you haven't really given it a go because you'd have to learn something new? JSX is very low resistance to learn. Not that you have to use it; it's worth learning it because it makes you more productive. I use Angular for my main product, but chose to go with React for a new small sub-product to see how it worked. I learnt JSX, I learnt how you should do things. I followed something similar to the Flux patterns in the time I had available. Now, I feel in a much better position to make an informed choice in the future. Using React helped me to appreciate the things Angular does well, it also showed me areas where things could be done better. There isn't a 'better' framework in either case. You need to understand the tradeoffs to know where one or other is going to be a good fit. This is always the case in software.
- jacobr 12y agoWith React, the only thing a new developer joining your team needs to know to do their first UI change is: - JavaScript - React.render - React.DOM.tagName(props, children) I agree about JSX, because it introduces 1) general complexity, 2) steeper learning curve, 3) incompatibility with other tools. But React works fine without JSX! Just structure your app properly with small components and DOM.div(...) isn't that noisy.