Seat booking with Redux
Let's enhance our seat booking app by integrating the Redux.
We can install React Bindings explicitly, using the following command, since they are not included in Redux by default:
npm install --save react-redux
Now, we will extend our seat booking app by integrating Redux. There will be a lot of changes as it will impact all of our components. Here, we will start with our entry point.
src/index.js
:
import React from 'react' import { render } from 'react-dom' import { createStore, applyMiddleware } from 'redux' import SeatBookingApp from './containers/SeatBookingApp' import { Provider } from 'react-redux' import { createLogger } from 'redux-logger' import thunk from 'redux-thunk' import reducer from './reducers' import { getAllSeats } from './actions' const middleware = [thunk]; //middleware will print the logs for state changes if (process.env.NODE_ENV !== 'production') { middleware.push(createLogger()); } const store = createStore( reducer, applyMiddleware...