How to use React-redux to avoid local state in my code?
问题 I am learning redux and I have put up a simple code which uses the store, action and reducer. I am using store.subscribe() to listen for changes in the state and using it to update my local state. Below is my entire code in index.js: import React from 'react'; import ReactDOM from 'react-dom'; import { createStore } from 'redux'; var store = createStore(changeState); var initialState = { qty: 0, price: 0 } function changeState(state = initialState, action) { switch (action.type) { case