fedosejev / react-essentials

Supporting React.js Essentials book readers.
http://reactessentials.com
219 stars 90 forks source link

Chapter 4: No way to test the code... #112

Open T0aD opened 7 years ago

T0aD commented 7 years ago

Hi,

I liked the book in the way it helps to learn by trying but from Chapter 4, I became quite frustrated as all examples will fail.. whats the point of even typing code to learn from that case ? Such a waste... (I hate blind coding)

` $ gulp [14:08:15] Using gulpfile /react/snapterest/gulpfile.js [14:08:15] Starting 'default'... im about to learn reactjs ! events.js:72 throw er; // Unhandled 'error' event ^ SyntaxError: /react/snapterest/source/app.js: Unexpected token (7:16) 5 | 6 | 7 | reactDOM.render(\<Application />, document.getElementById('react-application')); | ^ 8 | 9 | 10 | //reactDOM.render(Application, document.getElementById('react-application')); at Parser.pp$5.raise (/react/snapterest/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/index.js:4454:13) at Parser.pp.unexpected (/react/snapterest/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/index.js:1761:8) at Parser.pp$3.parseExprAtom (/react/snapterest/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/index.js:3750:12) at Parser.pp$3.parseExprSubscripts (/react/snapterest/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/index.js:3494:19) at Parser.pp$3.parseMaybeUnary (/react/snapterest/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/index.js:3474:19) at Parser.pp$3.parseExprOps (/react/snapterest/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/index.js:3404:19) at Parser.pp$3.parseMaybeConditional (react/snapterest/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/index.js:3381:19) at Parser.pp$3.parseMaybeAssign (/react/snapterest/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/index.js:3344:19) at Parser.pp$3.parseExprListItem (react/snapterest/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/index.js:4312:16) at Parser.pp$3.parseCallExpressionArguments (/react/snapterest/node_modules/babelify/node_modules/babel-core/node_modules/babylon/lib/index.js:3573:20)

Code source:

$ cat ./source/app.js var react = require('react'); var reactDOM = require('react-dom'); var Application = require('./components/Application.react'); reactDOM.render(\<Application />, document.getElementById('react-application'));

`

DongjiaoJin commented 7 years ago

hello, pls try
ReactDOM.render(, document.getElementById('react-application')); for the last line. pls pay attention to the first letter.

T0aD commented 7 years ago

Hi,

You mean ReactDOM instead of reactDOM ? What could it possibly change in a code that starts with: var reactDOM = require('react-dom'); ?