/react-redux-blog

An intermediate react redux tutorial blog app with a focus on CRUD routes, react-router-v4 and redux-form-v6.

Primary LanguageJavaScriptMIT LicenseMIT

React Redux Blog App

An intermediate tutorial app aimed at furthering React and Redux concepts and knowledge. This tutorial is aimed at:

The following README.md is to consolidate the key learning points for future reference.

The tutorial can be found here

Key Learning Points

State Structure

  • Use objects over arrays to store data.
  • Allows ease of access to specific data set.
  • Ex. using the lodash library:
export default function(state = {}, action) {
  switch (action.type) {
    case FETCH_POSTS:
      return _.mapKeys(action.payload.data, 'id');
    default:
      return state;
  }
}

Injection action creator shortcut

  • If an object is passed, each function inside it is assumed to be a Redux action creator.
connect(mapStateToProps, { fetchPosts })(PostsIndex);