When I render OfferList through React Router, The result is a rejected promise, saying:
`An error occured when handling the DONE state of a fetch`
{
message: "Not found",
name: "Not found",
status: 404
}
import React from 'react'; | |
function animateIn(Component){ | |
return class DecoratedComponent extends React.Component { | |
componentWillEnter(){ | |
// Do some swanky animation | |
} | |
render(){ | |
// Inherit all props |
// index.js | |
// by requiring `babel/register`, all of our successive `require`s will be Babel'd | |
require('babel/register'); | |
require('./server.js'); | |
// server.js | |
import express from 'express'; | |
let app = express(); | |
const PORT = 3000; |
import _ from 'underscore'; | |
export function on(eventName){ | |
return function(target, name, descriptor){ | |
if(!target.events) { | |
target.events = {}; | |
} | |
if(_.isFunction(target.events)) { | |
throw new Error('The on decorator is not compatible with an events method'); | |
return; |
const { assign } = Object; | |
class Directors { | |
onFetch(directors) { | |
this.directorsHash = directors.reduce((memo, director) => | |
assign(memo, { [director.id]: director }) | |
, {}); | |
} | |
} |
import React, { Component } from 'react'; | |
class Parent extends Component { | |
getInitialState(){ | |
return { | |
title: 'Hello world!'; | |
} | |
} | |
render(){ | |
return ( |
import _ from 'underscore'; | |
/** | |
* Backbone utility, to listen to multiple Backbone Events, | |
* structured like the native 'events' hash. Shortcuts things like | |
* `collectionEvents` on CollectionView, and `triggers` on Views. | |
* @param {class instance} obj object to listen to. | |
* @param {object} eventHash hash of events (prop:event, prop on current object) and handlers (value) | |
* @param {class instance} context optional context to call handlers with. | |
* @return {null} Doesn't return. |
When I render OfferList through React Router, The result is a rejected promise, saying:
`An error occured when handling the DONE state of a fetch`
{
message: "Not found",
name: "Not found",
status: 404
}
import BaseView from './BaseView'; | |
import listenToMany from '../utils/listenToMany'; | |
import template from '../templates/user'; | |
// Backbone's extend + ES6 | |
export default BaseView.extend({ | |
template, | |
listenToMany | |
}); |
As a stand-in to a full-fledged, publicly accessible JSON API, it would be incredibly liberating to have a Handlebars helper which allows us to loop through posts by parameters (maybe query params could even be mixed into the Handlebars context) instead of some internal state dictated by the URL. This would allow for easy creation of "related content", or a "search" function.