| Before | After |
|---|
export default function featureToggles(state={}, action) {
switch (action.type) {
case Actions.FEATURE_TOGGLES_UPDATED:
return { ...state, ...action.data };
default:
return state;
}| import React from 'react'; | |
| import stateTransformers from './searchFormStateTransformers'; | |
| import SearchForm from './SearchForm'; | |
| module.exports = class SearchFormContainer extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = // initial state | |
| this.stateUpdaters = { | |
| updateFilters: (filterName, filterValue) => |
| module.exports = { | |
| updateFilters: currentFiltersState => (filterName, filterValue) => // return new filers state containing the updated filter value | |
| clearFilters: currentFiltersState => // return new state reset to initial value | |
| switchTab: currentFiltersState => // return new state containing the location filter value from previous tab | |
| routeFilters: currentFiltersState => mostRecentSearch => // return new state containing user's most recent location search | |
| selectSearchHistory: currentFiltersState => selectedSearchFromHistory => // return selected search item from search history | |
| }; |
| const initialState = // initial state; | |
| module.exports = (state = initialState, action) => { | |
| switch (action.type) { | |
| case FILTER_UPDATED: // return new state containing the updated filter value | |
| case FILTERS_CLEARED: // return new state reset to initial value | |
| case TAB_SWITCHED: // return new state containing the location filter value from previous tab | |
| case FILTERS_ROUTED: // return new state containing user's most recent location search | |
| case SEARCH_HISTORY_ITEM_SELECTED: // set the state to the selected item from search history | |
| default: return state; |
| Before | After |
|---|
export default function featureToggles(state={}, action) {
switch (action.type) {
case Actions.FEATURE_TOGGLES_UPDATED:
return { ...state, ...action.data };
default:
return state;
}| export default function featureToggles(state={}, action) { | |
| switch (action.type) { | |
| case Actions.FEATURE_TOGGLES_UPDATED: | |
| return { ...state, ...action.data }; | |
| default: | |
| return state; | |
| } | |
| } |
| const logged = ComposedComponent => React.createClass({ | |
| render() { | |
| console.log(`Rendering ${ComposedComponent.displayName}`); | |
| return <ComposedComponent ...{this.props} /> | |
| } | |
| }); |
| { | |
| "linkedSalespeopleIds" : [ | |
| "1019739" | |
| ], | |
| "name" : "Tanya Su", | |
| "emailAddresses" : [ | |
| "[email protected]" | |
| ], | |
| "agency" : { | |
| "name" : "Anderson & Co. Century 21 - Carnegie", |
| // The following, models a HAL Resource based on HAL specification: | |
| // http://stateless.co/hal_specification.html | |
| // And provides Argonaut JSON encoders for that model | |
| // (Argonaut is a purely functional Scala JSON library) | |
| // http://argonaut.io/ | |
| import shapeless._ | |
| import shapeless.ops.hlist.{ToTraversable, Mapper} | |
| import argonaut._, Argonaut._ | |
| import scala.language.existentials | |
| import scala.language.higherKinds |
| // The following, models a HAL Resource based on HAL specification: | |
| // http://stateless.co/hal_specification.html | |
| // And provides Argonaut JSON encoders for that model | |
| // (Argonaut is a purely functional Scala JSON library) | |
| // http://argonaut.io/ | |
| import shapeless._ | |
| import shapeless.ops.hlist.{ToTraversable, Mapper} | |
| import argonaut._, Argonaut._ | |
| /////////////////////////// |