Views are primarily the React Views, which essentially generate the actions. Controller-View listens to our stores, for any changeEvent
been broadcasted. The emitChange
events let our Controller-Views know if any change has to be performed into the state of the view or not. They are essentially React components. In our code, we have five such react components, as follows:
app-addbooktoreadinglist.js
app-booklist.js
app.js
app-readinglist.js
app-removefromreadinglist.js
The following is the code for app-booklist.js
:
var React = require('react'); var AppStore = require('../stores/app-stores'); var AddBookToReadingList = require('./app-addbooktoreadinglist') function getLibrary(){ return {items: AppStore.getLibrary()} } var BookList = React.createClass({ getInitialState:function(){ return getLibrary() }, render:function(){ var items = this.state.items.map(function(item){ return ( <tr key={item.id}> <td>{item.title}<...