Open richard-hijzen opened 6 years ago
Same here... Can't figure this one out. Following...
well It s said that in the course ;
Having state outside the constructor() means it is a class field, which is a proposal for a new change to the language. It currently isn't supported by JavaScript, but thanks to Babel's fantastic powers of transpiling, we can use it!
But It seems that Babel cant help right now , or some other bug ..
I handled that old fashion way to continue on course till I or someone found out the main problem ..
class App extends Component { constructor(props) { super(props); this.state = { contacts: [ { id: 'ryan', name: 'Ryan Florence', email: 'ryan@reacttraining.com', avatarURL: 'http://localhost:5001/ryan.jpg' }, { id: 'michael', name: 'Michael Jackson', email: 'michael@reacttraining.com', avatarURL: 'http://localhost:5001/michael.jpg' }, { id: 'tyler', name: 'Tyler McGinnis', email: 'tyler@reacttraining.com', avatarURL: 'http://localhost:5001/tyler.jpg' } ] }; }
I'm not sure, but updating npm and node versions via nvm may solve this problem.
After installing nvm, you can use the codes below. Installing and using the last remote version solved my problem - some different error messages when compiling. Source
Find out which version of Node.js you are using:
node --version
Find out which versions of Node.js you may have installed and which one of those you're currently using:
nvm ls
List all versions of Node.js available for installation:
nvm ls-remote
Apparently for Windows the command would be rather like this:
nvm ls available
Assuming you would pick Node.js v8.1.0 for installation you'd type the following to install that version:
nvm install 8.1.0
You are then free to choose between installed versions of Node.js. So if you would need to use an older version like v4.2.0 you would set it as the active version like this:
nvm use 4.2
I've got 2 errors when i give the command npm start.
Line 8: 'state' is not defined no-undef Line 16: 'removeContact' is not defined no-undef
Is there something else needed?