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
// Transduceres belong to the family of Structural design patterns compostion | |
// This GIST covers all of the cases that we would currently use | |
// .map, .filter, and .reduce for with arrays, and the | |
// composable transducers don’t make multiple copies of the data set. | |
// Transducers as developed for production code bases cover more use cases, | |
// such as replicating the functionality of .find. | |
// http://raganwald.com/2017/04/30/transducers.html |
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
/** | |
* Command Interface | |
* @param {*} state | |
*/ | |
const CommandI = (state) => ({ | |
type: 'CommandI', | |
execute: (...rest) => state.execute(...rest), | |
}); | |
/** |
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
/** | |
* Command Interface | |
* @param {*} state | |
*/ | |
const CommandI = (state) => ({ | |
type: 'CommandI', | |
execute: (...rest) => state.execute(...rest), | |
}); | |
/** |
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
const options = { | |
name: 'posts.item', | |
// Which key should become data key for state in hoc | |
key: 'document', | |
// load initial data | |
async selectData(service, props) { | |
// if independent from another components props | |
return service.get(props.documentId) |
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 React, { Component } from 'react'; | |
import errors from 'feathers-errors'; | |
import { APP_REST } from './../../components/constants'; | |
import { setDisplayName } from './utils'; | |
import { forEach, omit } from './../../utils'; |
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 React, { PureComponent } from 'react'; | |
import errors from 'feathers-errors'; | |
import { withPreloader } from './../../redux/container'; | |
import { APP_REST } from './../../components/constants'; | |
import { setDisplayName } from './utils'; |
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
componentDidMount() { | |
const events = [{ | |
service: 'conversation', | |
event: 'created', | |
eventFunc: this.addConversation, | |
}, | |
{ | |
service: 'conversation', | |
event: 'removed', | |
eventFunc: this.removeConversation, |
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 React, { PureComponent } from 'react'; | |
import { APP_REST } from './../../components/constants'; | |
import { setDisplayName } from './utils'; | |
import { forEach, map, arrayIsEmpty } from './../../utils'; | |
class BaseType { | |
constructor(props) { |