I am trying to make simple example of event module of node.I saw this video.I am trying to make same example on code pen.But it is not working why ?
https://www.youtube.com/watch?v=PvjNglsyOHs&index=9&list=PLoYCgNOIyGABj2GQSlDRjgvXtqfDxKm5b
here is my code
http://codepen.io/naveennsit/pen/dMBVaz?editors=1010
var {EventEmitter}=events;
class Todostore extends EventEmitter {
constructor(){
super();
this.todo= [{
hse: 'asd'
}, {
hse: 'adas'
}]
}
getAll(){
return this.todo;
}
}
const todostore =new Todostore;
class App extends React.Component {
constructor(props) {
super(props);
console.log('----')
this.state = {
data:todostore.getAll()
};
}
render() {
return <ul > {
this.state.data.map((item) => {
return <li
> {
item.hse
} < /li>;
})
} <
/ul>
}
}
React.render( < App / > , document.getElementById('app'))