News for hackers. Stuff that matters.
Re:React.js Introduction for People Who Know Just Enough JQuery by michaelbuddy on Thursday July 09, 2015 @11:40AM (#9858507)
I haven't gone through this page yet, but thank you for at least the attempt at reaching somebody in my state of affairs. Front End work is very hard. The front end design & what I would call the back-end front-end disciplines are supposed to meld together according to job postings and over-zealous recruiters, but it's a good deal more complex than I have been willing to put up with, mostly because of the materials to get started and the unintuitive tools that people who know what they are doing swear by.

Imagine being solid at design, pushing pixels, using HTML, CSS. Then suddenly these program frameworks which are created by back-end programmers not visual designers appear and the ramp up for the average technical person is immense. For me it's been enough to turn me off them all together and make it a talking point that "my javascript skills fall off at X,Y or Z" so recruiters and employers know that despite being able to do a lot, I can't suddenly become everything UI and everything back end just because the title of anything "front end" is so versatile.

Re:React.js Introduction for People Who Know Just Enough JQuery by applecore on Thursday July 09, 2015 @12:53PM (#9859104)
What do you mean? This:

    var createItem = function(itemText) {
      return (
        <li>{itemText}</li>
      );
    };
    return (
      <ul>{this.props.items.map(createItem)}</ul>
    );
...is clearly so much more logical than:

    <ul><li>{{item}}</li></ul>
Source: https://www.airpair.com/angularjs/posts/angular-vs-react-the...
Re:React.js Introduction for People Who Know Just Enough JQuery by oinksoft on Thursday July 09, 2015 @08:05PM (#9861538)
That named helper function isn't necessary, so this might be more appropriate:

  return <ul>
    {this.props.items.map(item => <li>{item}</li>)}
  </ul>;
vs. the Angular version:

  <ul ng-repeat="item in items">
    <li>{{ item }}</li>
  </ul>
The Angular template is more readable at the expense of ngRepeat's complexity. Neither example includes Component/directive boilerplate. The directive boilerplate is generally worse, because it requires a separate template file or an ugly template string, knowledge of the directives API itself which is baroque in the extreme, and $scope-wrestling (whereas JSX' scope is the same as JS').

In my opinion reuse of the React component is more straightforward, you explicitly import/require it while in Angular you specify its providing module as an angular.module dependency, which has implications for config block ordering.

Re:React.js Introduction for People Who Know Just Enough JQuery by btown on Thursday July 09, 2015 @08:51PM (#9861718)
I used to struggle to answer this when talking to Angular folks about React. Then I came across a situation where I needed to recursively build a DOM tree based on complicated calculations on a per-node basis and also calculated values at the top level. If I'd been doing it with ng-repeat, the logic would be split confusingly (and unnecessarily) between the template and the controller, and I'd need to pass down any information from the top-level ancestor manually.

In React, I just create a renderNode method that's called by render at the top level, and renderNode on non-terminal nodes returns <div>{children}</div> where children is a map whose mapping function returns this.renderNode. The entire algorithm is grokkable at a single glance, and there's no need to create Directives to add any fancy features or special cases in the future. No need to read pages of documentation about ng-repeat and its intricacies; it's all just Javascript.

Yes, Angular "just works." But React "just works" the first time you try it.

Re:React.js Introduction for People Who Know Just Enough JQuery by benibela on Sunday July 12, 2015 @07:06AM (#9873118)
There is also XQuery. Like React, but you do not need to distinguish properties and map calls, it is all done with the / operator:

    <ul>{props/items/item/<li>{.}</li>}</ul>
But not interactive
Re:React.js Introduction for People Who Know Just Enough JQuery by garry on Thursday July 09, 2015 @01:49PM (#9859513)
This obscures React's main strength, which is making it so that you don't have to worry about edge case states. In complex UI's, this is the #1 source of bugs.
Re:React.js Introduction for People Who Know Just Enough JQuery by applecore on Thursday July 09, 2015 @04:06PM (#9860336)
For sure! But you should have empathy for the front-end designer who may not totally understand the advantages of React over "traditional" HTML templates and directives.
Re:React.js Introduction for People Who Know Just Enough JQuery by mrev19 on Thursday July 09, 2015 @03:22PM (#9860124)
Besides incorrectly quoting the example at the cited link and being a deceptive/incomplete comparison, what does this even have to do with the op?
Re:React.js Introduction for People Who Know Just Enough JQuery by munro on Thursday July 09, 2015 @05:47PM (#9860923)
If you like Angular's style you can use react-templates [1], most people just prefer the React way. In theory there shouldn't be any overhead, but since in JavaScript abstractions aren't free you're going to pay some price.

Also the angular equivalent would be

    <ul><li ng-repeat="item in items">{{item}}</li></ul>
And the react-templates equivalent would be

    <ul><li rt-repeat="item in this.state.items">{item}</li></ul>
[1] http://wix.github.io/react-templates/
Re:React.js Introduction for People Who Know Just Enough JQuery by cdelsolar on Thursday July 09, 2015 @02:11PM (#9859669)
Yes it is. What is {{item}}? Where did it come from?
Re:React.js Introduction for People Who Know Just Enough JQuery by ehsanu1 on Thursday July 09, 2015 @02:18PM (#9859716)
It's missing the `ng-repeat="item in items"`.
Re:React.js Introduction for People Who Know Just Enough JQuery by pete_mitchell on Thursday July 09, 2015 @02:31PM (#9859798)
What is "items" and where did it come from?
Re:React.js Introduction for People Who Know Just Enough JQuery by ehsanu1 on Thursday July 09, 2015 @03:09PM (#9860050)
It would be some array defined on the angular $scope object, presumably instantiated when an angular directive/controller is instantiated for a component. I'm guessing that's roughly analogous to "this.props" in the react example, though I'm not very familiar with react.
Re:React.js Introduction for People Who Know Just Enough JQuery by vvpan on Thursday July 09, 2015 @03:17PM (#9860099)
That is a terrible comparison.
Re:React.js Introduction for People Who Know Just Enough JQuery by thirdtruck on Thursday July 09, 2015 @11:49AM (#9858584)
I feel your pain. Job expectations for front-end work (and, no doubt, other tech areas) have grown terribly incoherent. It seems like a lot of companies expect new hires to train themselves into unicorns on their current employer's time, when they could just hire someone now and give them a decent amount of time to ramp up instead.
Re:React.js Introduction for People Who Know Just Enough JQuery by michaelbuddy on Thursday July 09, 2015 @12:14PM (#9858792)
I think for the needs of front end, the recruiting world would be better off targeting back end people heavy programmers, maybe .net or java and their migration to the front end frameworks will be much easier than the designers will be. It sounds awesome for a designer to pick up javascript and just run with it, but I personally see a pretty thick wall between focusing on design, graphics, presentation and then solving all the programming problems to go with it. Again personal experience, it's been easier for me to shut off the valve of code completely, so I'm not distracted by consequences of how it will be built. I know that sounds counter intuitive but just knowing some of the avid javascripters, those who can build apps with it, they don't really have the ability to get out of that mode to design something, they are always living the framework. They will make something nice, but alone their work rarely surpasses the level of beauty or refinement of a really good designer artist.

Yes I know those hybrids exist, but unfortunately there aren't nearly enough of them to fill all the positions. Not only that, but I'd argue that a lot of them who are hybrids, you're not going to get their best work from both areas if they are expected to deliver from both disciplines on projects. Not on the deadlines that employers will set at least.

And I suspect a similar problem exists in actual building architecture. Yeah some building designers are good at accomodating for all the variables of planning codes, but they aren't going to be (nearly as often) fantastic at aesthetics that somebody who works outside those constraints might be capable of. There's a lot of value in designing first, then put those styles of thinking together (designers and architects) separate people and from that point later in the process of creation you start solving the challenges like plumbing codes, metallurgy afterwards. Part of this is me complaining, but it's my attempt at experience of always being a crossover person and how you never really feel like you're honing a craft, you just feel like you're being left behind and not properly cultivating what you enjoy most.

Re:React.js Introduction for People Who Know Just Enough JQuery by ritchiea on Thursday July 09, 2015 @05:20PM (#9860771)
The problem is anyone who identifies himself or herself as a backend person probably hates dealing with HTML & CSS. And that's without also getting into the backend devs who also despise Javascript. As far as I can tell anyone who is a backend dev only is saying "I don't want to deal with any of the bullshit on the front end." Good luck convincing those people the next technology they should learn is React or Angular or SCSS.
Re:React.js Introduction for People Who Know Just Enough JQuery by michaelbuddy on Monday July 13, 2015 @05:42PM (#9881348)
fantastic point.
Re:React.js Introduction for People Who Know Just Enough JQuery by ricardobeat on Thursday July 09, 2015 @07:22PM (#9861369)
These frameworks are not actually created by back-end programmers, clientside code has become as complex and specialized (sometimes more) than the server in the past decade.

But there is still room for good designers who code; plenty of research, user testing and prototyping to be done before getting down the tech rabbit hole. A good team is multi-disciplinary and not necessarily composed of 'unicorns' only.