Hi, got error from tasks 3


#1

So on task 3, “in App.js, give App a new property named chooseVideo. Set chooseVideo’s value equal to a function with one parameter, named newVideo.” and there is a hint example which is off the syntax that the program initially has provided.
chooseVideo: function (newVideo) {
this.setState({
src: VIDEOS[newVideo]
});
},

render: function () {

I don’t know why the task hint is given this way.
So I just did it this way.

=============================================================================

import React from ‘react’;
import ReactDOM from ‘react-dom’;
import { Video } from ‘./Video’;
import { Menu } from ‘./Menu’;

const VIDEOS = {
fast: ‘https://s3.amazonaws.com/codecademy-content/courses/React/react_video-fast.mp4’,
slow: ‘https://s3.amazonaws.com/codecademy-content/courses/React/react_video-slow.mp4’,
cute: ‘https://s3.amazonaws.com/codecademy-content/courses/React/react_video-cute.mp4’,
eek: ‘https://s3.amazonaws.com/codecademy-content/courses/React/react_video-eek.mp4
};

class App extends React.Component {
constructor(props) {
super(props);
this.chooseVideo = this.chooseVideo.bind(this);
this.state = { src: VIDEOS.fast };
}

chooseVideo(newVideo) {
this.setState({
   this.state.src: VIDEOS[newVideo]
});

}

render() {
return (


Video Player





);
}
}

ReactDOM.render(
,
document.getElementById(‘app’)
);

And the result page is blank. I couldn’t see anything.

Please let me know what is wrong and how I could fix it.


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.