<commit_before>import { combineReducers, createStore } from 'redux';

const defaultObject = {};

const defaultArray = [];

const userReducer = (state=defaultObject, action) => {
  switch(action.type) {
    case "CHANGE_NAME": {
      state = {...state, name: action.payload}
      break;
    }
    case "CHANGE_AGE": {
      state = {...state, age: action.payload}
      break;
    }
  }
  return state;
};

const tweetsReducer = (state=defaultArray, action) => {
  return state;
};

const reducers = combineReducers({
  user: userReducer,
  tweets: tweetsReducer
});

// const store = createStore(reducers, {
//   user: {
//     name: "Will",
//     age: 35
//   },
//   tweets: []
// });

const store = createStore(reducers);

store.subscribe(() => {
  console.log("store changed", store.getState())
});

/* The action have to have a "type" into it */

store.dispatch({
  type: "CHANGE_NAME",
  payload: "Will"
});

store.dispatch({
  type: "CHANGE_AGE",
  payload: "35"
});

store.dispatch({
  type: "CHANGE_NAME",
  payload: "Francisco"
});

store.dispatch({
  type: "CHANGE_AGE",
  payload: "27"
});
<commit_msg>[UPDATE] Client Redux Middleware Start<commit_after>import { createStore } from 'redux';

const reducer = (initialState = 0, action) => {
  if (action.type === "INC") {
    return initialState + 1;
  } else if (action.type === "DEC") {
    return initialState - 1;
  } else {
    return initialState;
  }
}

const store = createStore(reducer, 1);

store.subscribe(() => {
  console.log("store changed", store.getState())
});

/* The action have to have a "type" into it */

store.dispatch({
  type: "INC"
});

store.dispatch({
  type: "INC"
});

store.dispatch({
  type: "INC"
});

store.dispatch({
  type: "DEC"
});

store.dispatch({
  type: "DEC"
});

store.dispatch({
  type: "DEC"
});

{'fraction_non_alphanumeric': 0.18106312292358803, 'fraction_numerical': 0.005537098560354375, 'mean_word_length': 3.34375, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '920286', 'n_tokens_mistral': 646, 'n_tokens_neox': 631, 'n_words': 152}