function todoApp(state = initialState, action) {
  switch (action.type) {
    case SET_THEME:
      return Object.assign({}, state, {
        theme: action.newTheme
      })
    case ADD_TODO:
      return Object.assign({}, state, {
        todos: [
          ...state.todos,
          {
            text: action.text,
            completed: false
          }
        ]
      })    
    default:
      return state
  }
}var obj = {
    foo: 'bar'
}
var otherObj = {
    num: 5
}
var newObj = Object.assign({}, obj, otherObj);
console.log(newObj) // {foo: 'bar', num: 5}import React from 'react';
import {connect} from 'react-redux';
class ProductsComponent extends React.Component {
    render () {
        <div>
            {this.props.products}
        </div>
    }
}
function mapStateToProps(state) {
    return {
        products: state.products
    }
}
export default connect(mapStateToProps)(ProductsComponent)