Skip to content

Instantly share code, notes, and snippets.

View andycarrell's full-sized avatar

Andy Carrell andycarrell

View GitHub Profile
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: "stable",
class FormWithSomeCouponInput extends React.Component {
constructor(props) { ... }
handleCouponBlur() {
const { coupon, actions } = this.props;
actions.applyBlur('coupon');
actions.submitCoupon({ coupon });
}
class FormWithSomeCouponInput extends React.Component {
constructor(props) { ... }
handleCouponBlur() {
const { coupon, actions } = this.props;
actions.applyBlur('coupon');
actions.submitCoupon({ coupon });
}
class FormWithSomeCouponInput extends React.Component {
constructor(props) { ... }
handleSubmitCoupon() {
const { coupon, actions } = this.props;
actions.submitCoupon({ coupon });
}
handleCouponBlur() {
import thisApiMw from './thisApiMw'
import thatApiMw from './thatApiMw'
import someApiMw from './someApiMw'
const mws = {
thisApiMw,
thatApiMw,
someApiMw
}
// Returns 'a' middleware
const combineMiddlewares = (...middlewares) => store => {
// Map over applying store
const stored = middlewares.map(mw => mw(store))
return next => {
// Map over applying the next as 'next'
const [first, ...rest] = stored
const nextMiddlewares = [...rest, next]
// Should this be done in reverse?
// (apply 'next', then through the chain & mutate locally?)