reactjs – React with Redux – Using Connect

Create a Redux store with createStore.

import { createStore } from 'redux'
import todoApp from './reducers'
let store = createStore(todoApp, { inistialStateVariable: "derp"})

Use connect to connect component to Redux store and pull props from store to component.

import { connect } from 'react-redux'

const VisibleTodoList = connect(
  mapStateToProps,
  mapDispatchToProps
)(TodoList)

export default VisibleTodoList

Define actions that allow your components to send messages to the Redux store.

/*
 * action types
 */

export const ADD_TODO = 'ADD_TODO'

export function addTodo(text) {
  return { type: ADD_TODO, text }
}

Handle these messages and create a new state for the store in reducer functions.

function todoApp(state = initialState, action) {
  switch (action.type) {
    case SET_VISIBILITY_FILTER:
      return Object.assign({}, state, {
        visibilityFilter: action.filter
      })
    default:
      return state
  }
}

if you want to reproduce, please indicate the source:
reactjs – React with Redux – Using Connect - CodeDay