JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdn.jsdelivr.net/underscorejs/1.8.3/underscore.js"></script>
<script src="https://cdn.jsdelivr.net/backbonejs/1.2.3/backbone.js"></script>
Babel + JSX
const { Model, Collection } = Backbone;
class Plant extends Model {
defaults() {
return {
name: 'Not specified',
height: 0
}
}
}
class Greenhouse extends Collection {
constructor(options) {
super(options);
this.model = Plant;
}
}
let plant1 = new Plant({ name: 'Rose' });
let plant2 = new Plant({ name: 'Daisy' });
let house = new Greenhouse([plant1, plant2]);
house.each(function(plant) {
console.log(plant.get('name'))
});