Skip to content

Instantly share code, notes, and snippets.

@scneptune
Last active January 30, 2018 22:20
Show Gist options
  • Save scneptune/e1bc845ed569b6e2598458ac9a87f40e to your computer and use it in GitHub Desktop.
Save scneptune/e1bc845ed569b6e2598458ac9a87f40e to your computer and use it in GitHub Desktop.

-DUCKS: namespace action names within the reducer to prevent collisions ala: "delivery/ADD_DELIVERY_ITEM";

  • https://jaysoo.ca/2016/02/28/organizing-redux-application/ Main takeaways: application structure is broken up by feature functionality not component type, Create a feature functionality index in which all other components, actions and reducers originate, use this index to allow components and modularity to be shared with other feature functionality folders. Levy calls to connected state of other features, by adding data manipulations on the parent feature, that way when the data contract changes in the parent feature, child features that implement the method will not have to be refactored. Ultimately this is to prevent circular dependencies.

a good case for this, would be when utilizing a list of item on another component, make the filtering and formatting occur on the parent component, and send the result back to the child component, so that it can literally parameterize the filter by value.

Other Ideas:

React Components do not need to do data calculation, props that are sent into a connected component should be fully calculated. This allows us test components in the future.

an example of this would be

const mapStateToProps = (store, props) => {
  let { a, b } = store.aReducer;
  isAdmin = a.includes('admin');
  return { isAdmin, b, props }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment