Hacker News new | ask | show | jobs
by autoreleasepool 3347 days ago
The example in the article was lifted from the front page of the official React website [0].

[0] https://facebook.github.io/react/

1 comments

It wasn't lifted from the docs. The tutorial is a tic-tac-toe game, while the example in the post is an AddTodo function [edit: there appears to be an add todo section, but the code is completely different]. Furthermore, all the examples in the tutorials show a pattern where you reference functions instead of writing them inside JSX.
Check again. On the homepage scroll down to:

> An Application

" Using props and state, we can put together a small Todo application. This example uses state to track the current list of items as well as the text that the user has entered. Although event handlers appear to be rendered inline, they will be collected and implemented using event delegation. "

Fair enough - it's a todo app. The code isn't structured in the same manner as the author's, however, so my point stands. It doesn't look like the code was lifted from the docs, as you said, but instead transformed to look like spaghetti.