5 ms·
As an aside, I hate the official React tutorial and am disappointed that there are no revisions to it with this significant redesign and React version update. I
by minimaxir 9y ago
As an aside, I hate the official React tutorial and am disappointed that there are no revisions to it with this significant redesign and React version update. It is the embodiment of the “how to draw an owl” meme, requiring you to have a strong JS frontend background in the first place, and the resulting demo application doesn’t give much insight in how to use React for standard websites. (Unfortunately, this isn’t unique to the official React tutorial; many React tutorials are like this)
Contrast with the official Vue.js tutorial (https://vuejs.org/v2/guide/ https://vuejs.org/v2/guide/), which goes through things step by step with normal HTML syntax.
- bluetidepro 9y agoA Tweet by @reactjs: > We hope the new site will make it easier for you all to contribute improvements as well. We look forward to working with you to improve it! [1] This was just the first phase of them moving to the new site. They understand that the docs can be better. Maybe instead of just complaining about them, you contribute to them to make them more "noob" friendly, like you are describing. [1] https://twitter.com/reactjs/status/913797589421629440 https://twitter.com/reactjs/status/913797589421629440
- Goopplesoft 9y ago> requiring you to have a strong JS frontend background in the first place Is that a high bar for a JS frontend framework? Serious question, as it doesn't seem that way to me. This seems analogous to saying "Django docs require you to know python" or "Postgres docs require you to understand how databases work".
- vanderZwan 9y agoI lost an entire week of work last year to not knowing that React switched from automatically binding methods, because none of the documents mentioned that. Including the release notes of the version of React where they turned that off, IIRC. It is easily the most rage-inducing programmer moment I ever had, mainly because it's so fucking stupid and the only reason it took me so long was because the actual tutorial and documentation was fucking lying to me. Technically speaking they fixed it by now: they mention the bind-thingy under "Handling Events" in the documentation, which you randomly have to stumble upon: constructor(props) { super(props); this.state = {isToggleOn: true}; // This binding is necessary to make `this` work in the callback this.handleClick = this.handleClick.bind(this); } handleClick() { this.setState(prevState => ({ isToggleOn: !prevState.isToggleOn })); } However, the tutorial is still deceiving: constructor() { super(); this.state = { squares: Array(9).fill(null), }; } handleClick(i) { const squares = this.state.squares.slice(); squares[i] = 'X'; this.setState({squares: squares}); } This is fine in this specific situation because the render method uses a closure: onClick={() => this.handleClick(i)} But this is a subtle nuance that can be an incredible pain to figure out. There is no mention of all the this-related pains in the tutorial anywhere. [0] https://reactjs.org/tutorial/tutorial.html https://reactjs.org/tutorial/tutorial.html [1] https://reactjs.org/docs/handling-events.html https://reactjs.org/docs/handling-events.html
- danabramov 9y agoI think you might be mistaken. `React.createClass` always did autobinding, and it still does. The ES6 classes (which the tutorial now uses) never supported autobinding. React documentation switched from `React.createClass` to ES6 classes because they community already did at that point, and wanted to see the more "mainstream" pattern documented. I'm sorry it wasn't obvious that there is a difference between the function call and the language syntax, but it's definitely not a change in React. The tutorial you mention works fine because `onClick={() => this.handleClick(i)}` is an alternative way to bind methods that also works. That's what the tutorial uses because it's easier to explain React first without diving into how `this` works in ES6 classes. And you can run that code and verify it works. (Every step of the tutorial has a link with a code example.) So no, it has not been broken for a year. We also did blog about ES6 class support: https://reactjs.org/blog/2015/01/27/react-v0.13.0-beta-1.html#plain-javascript-classes https://reactjs.org/blog/2015/01/27/react-v0.13.0-beta-1.htm... And autobinding of `React.createClass` (which you can still use—it's just in a separate package) is also still documented: https://reactjs.org/docs/react-without-es6.html https://reactjs.org/docs/react-without-es6.html That said I'm sorry about your bad experience.
- vanderZwan 9y agoComment-sniped before I could update my message. Yes, I was mistaken, it has been changed. > We also did blog about ES6 class support Not everyone reads blogs all the time. If a new product is released, it's reasonable to expect the documentation to mention the breaking changes.
- danabramov 9y agoThat's my point: there was no breaking change :-) React.createClass() always did (and still does) autobinding. ES6 classes never supported autobinding. We couldn't have changed your code from one to the other. There is no "release notes" associated with that change—changing the syntax was a conscious decision you made either when converting or when writing a new components.
- rmrfrmrf 9y agoConsidering backend developers are still routinely thrown on the frontend because “it’s easy and doesn’t need to look pretty,” I’d say yes.
- spicyj 9y agoAs the person who designed most of the tutorial, I'm sorry to hear this. My goal was to give people practice building a few simple components and connecting them together. It's true that we assume preexisting JS knowledge, but your other point about how it doesn't give much insight into using React is one I haven't heard before. Can you say more about what you mean? Anecdotally in my experience, most people seem to find the tutorial pretty helpful, but we can think about more options. Maybe there's space to add one that assumes less about JS. (And really -- thank you for complaining about this, or else we wouldn't have known.)
- mcintyre1994 9y agoThis is probably just me and feel free to disregard if this sounds silly, but I really wish miss the getting started guide from a few years ago that (iirc) had you drop an include statement in and go. I feel like React expects me to have a deep knowledge of JS build tooling when all I care about getting started is building a page locally that works and does cool things. FWIW this is how Vue's tutorial starts - and another really nice thing they do is teach you the API by entering things into your console on their tutorial page full of components. I don't really know if this is constructive or useful, I hope it is - I just feel like React expects a lot of new users in a way it didn't used to.
- spicyj 9y agoThanks! I agree the simplicity is compelling. Our Getting Started page does offer CDN script tags as an option but it's seemed like create-react-app is a better tool for most people getting started on a new app so we've had that more prominently.
- danabramov 9y agoThe tutorial asks you to either use CodePen (which requires no build tooling) or Create React App (which requires you to run a command in the terminal but then you don't need to configure anything): https://reactjs.org/tutorial/tutorial.html#how-to-follow-along https://reactjs.org/tutorial/tutorial.html#how-to-follow-alo... Similarly, the installation page offers you to either download a single HTML file, or to install a CLI that gives you a project that's ready to go: https://reactjs.org/docs/installation.html https://reactjs.org/docs/installation.html Could you clarify what give you an impression that you need to have a deep knowledge of build tooling to follow along?
- shados 9y agoThis does bring up an interesting point about the community and its different populations. JS includes _a lot_ of people, of all levels. You don't really have much choice but to do the lowest common denominators (people newer to it probably consist of the majority right now). When I went through the VueJS stuff originally, I had a feel of "Come on, get to the point already" as I went through pages over pages to get the whole idea. When I learnt React (originally when it came out), I looked at the first page, went quickly over the element creation (I was anti-jsx at the time. Times long gone, haha) and lifecycle hooks in like 5 minutes, went "Okay, got it. I already know how this works" and built an app. Obviously my situation is not the common one, so doc like VueJS should be standard...but having a good "tl;dr" is critical (maybe it is in there, I didn't look, but when I learnt Vue's basic, by the time I went through most of the pages looking for a tl;dr, I had found everything else)
- averageweather 9y agoBefore even finishing your comment, in my head I was saying "compared to vue.js where the tutorials instantly clicked for me". I'm no master js guru, and agree completely with you.
- deleted 9y ago[deleted]