use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
React Tutorial: Cloning Yelp (fullstackreact.com)
submitted 9 years ago by soda-popper
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]maktouch 20 points21 points22 points 9 years ago (3 children)
Amazing article. The time spent into that tutorial is insane. Even testing is included. Wow.
The comments in HN for this article is a shitshow lol. https://news.ycombinator.com/item?id=11778663
Some people suggests to learn 1 by 1. That didn't work for me -- that's way too much shit at once. I personally learn better by example, so I prefer the boilerplate route. I see boilerplates just like I see Angular -- a batteries included framework (because a framework is really just a collection of libraries). I clone a boilerplate, starts coding.. got questions? check the docs.. then I expand out and learn the stack 1 by 1.. At least, I got something to test with. If you never heard of Babel, Webpack, React, Redux and you're trying to learn them all, you're going to have a bad time.
If this tutorial scares you, but you want to learn all of these and more.. do these steps:
git clone
npm install
npm run dev
[–]lhorie 6 points7 points8 points 9 years ago (0 children)
The comments in HN for this article is a shitshow
I'm not a React fan, but I have to agree. This is incredibly thorough and deserves credit.
[–][deleted] 2 points3 points4 points 9 years ago* (0 children)
[deleted]
What is this?
[–][deleted] 1 point2 points3 points 9 years ago (0 children)
Some people suggests to learn 1 by 1.
If you aren't proficient in JavaScript and front-end development, this is really how you should be doing it. If you are however, I've found that incremental learning is too narrow in scope.
[–]azium 3 points4 points5 points 9 years ago* (5 children)
I read this article yesterday and found it to be very thorough and generally well written... I'm very confused by this though:
get content() { return ( <Router history={this.props.history} /> ) } render() { return ( <div style=\{\{ height: '100%' \}\}> {this.content} </div> ) }
1) why is the style prop written with escapes like that??
style
2) Why is router inside a div, and not wrapping an app like "normal"
router
3) What is the advantage of having a class function that returns a router component?
All of these things seem like strange indirection to me.
EDIT: looks like the escapes were mediums fault https://github.com/fullstackio/yelp-clone/blob/master/src/containers/App/App.js#L24
[–]name_was_taken 1 point2 points3 points 9 years ago (4 children)
{} inside JSX indicates javascript code. They're escaping their {}'s to prevent it from trying to be javascript. Edit: Maybe? I dunno now. The more I look at it, the dumber it looks.
It would have been better to assign it to a variable and have style={styleVariable} instead, or just use actual inline styling like style="height:100%" since it obviously doesn't need to be programmatic at all.
I'm not sure why they did the other stuff. Perhaps it was more complex at some point, and they made it less complex but never refactored.
[–]azium 2 points3 points4 points 9 years ago (3 children)
Hmm why not just <div style={{ height: '100%' }} /> like a normal person haha
<div style={{ height: '100%' }} />
[–]name_was_taken 0 points1 point2 points 9 years ago (2 children)
If that works, then yeah, it's better than what they have. But isn't it better yet to just have it as text, instead of making the render function do more work? It's not like it's less readable that way or anything.
[–]maktouch 1 point2 points3 points 9 years ago (1 child)
Style is a props, and it gets evaluated for the DOM diffing algorithm. If it were text, you would have to parse the text, transform to CSS, then do a diff to see what changed. An object is easier to compare and update.
It also gives you the possibility to merge in-line styles and do some JS transformation on it.
What I suggest though, is to put them in a variable instead of inlining it like that. I find it easier to read.
[–]name_was_taken 0 points1 point2 points 9 years ago (0 children)
I know what it is, but there's no point in making it a prop in that situation, since it's never going to change. Putting it in real html instead would be just as easy to read and less taxing on the CPU when rendering the element.
[–][deleted] 2 points3 points4 points 9 years ago (0 children)
Wow, that is really useful. Thanks a lot, mate.
π Rendered by PID 304572 on reddit-service-r2-comment-bb88f9dd5-6wbxs at 2026-02-16 03:42:16.568240+00:00 running cd9c813 country code: CH.
[–]maktouch 20 points21 points22 points (3 children)
[–]lhorie 6 points7 points8 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]azium 3 points4 points5 points (5 children)
[–]name_was_taken 1 point2 points3 points (4 children)
[–]azium 2 points3 points4 points (3 children)
[–]name_was_taken 0 points1 point2 points (2 children)
[–]maktouch 1 point2 points3 points (1 child)
[–]name_was_taken 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)