This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// container component | |
class HandlerA { | |
handleSubmit(event) { | |
// do stuff | |
} | |
render() { | |
const { | |
children // react-router passes your child in here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global MATCH_COMPONENTS */ | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import 'styles/master.css'; | |
import Playground from 'redocs/lib/playground/components/playground'; | |
const reqCoreManifests = require.context('./core/components', true, MATCH_COMPONENTS); | |
const reqAthenaManifests = require.context('./athena/components', true, MATCH_COMPONENTS); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Now your action creators can pull utilities our of their thunk api! | |
export function fetchUser(id) { | |
return ({api, dispatch}) => | |
api.fetch(`users/${id}`).then(resp => | |
dispatch({action: FETCH_USER, user: resp.body.data})); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// given a reference to mutableData we can't guarantee that .mutableProperty would | |
// still be the same reference *after* binding. | |
function Component({mutableData, onClick}) { | |
return <button onClick={event => onClick(mutableData.mutableProperty, event)} /> | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Page from 'components/messenger-inbox-page'; | |
import { | |
selectRoutedSupplierThread, | |
selectRoutedSupplierThreadMessages | |
} from 'services/messenger-service'; | |
const selector = createSelector([ | |
selectRoutedSupplierThread, | |
selectRoutedSupplierThreadMessages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
withReducer( | |
'setCounter', | |
(state, param) => | |
{counter: param, ...state}) | |
) | |
withReducers({ | |
setCounter: (state, param) => | |
{counter: param, ...state}) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create a "gated" (throttled) version of the user function. This throttling is not time | |
* based but rather throttles execution to prevent two async actions occuring in parallel. | |
* Ie. Two syncronous calls to the returned function will return reference to the same promise | |
* - An example use case of this would be to prevent firing too many api requests to the same | |
* endpoint in a short amount of time | |
* @param {Function} func func *must* return a promise | |
* @returns {Function} throttled function which will always return a promise | |
*/ | |
export function gate(func) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Responsive init ---------------- | |
import Responsive, {Breakpoints} from 'responsive'; | |
// Register breakpoints - creates a Symbol for each breakpoint descriptor | |
// - Basic breakpoint descriptor is as seen here. A simple desktop-first Number | |
Responsive.registerBreakpoints({ | |
SMALL: 320, | |
MEDIUM: 768, | |
LARGE: 1024 | |
}); |