Skip to content

Commit

Permalink
fix(example): fix example app to work with new routing
Browse files Browse the repository at this point in the history
fix #72
  • Loading branch information
landonreed committed Jul 18, 2019
1 parent 65f3fe5 commit 8cc820e
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// import necessary React/Redux libraries
import { createHashHistory } from 'history'
import { connectRouter, routerMiddleware } from 'connected-react-router'
import React, { Component } from 'react'
import { render } from 'react-dom'
import { createStore, combineReducers, applyMiddleware } from 'redux'
import { createStore, combineReducers, applyMiddleware, compose } from 'redux'
import { Provider } from 'react-redux'
import thunk from 'redux-thunk'
import createLogger from 'redux-logger'
Expand Down Expand Up @@ -38,19 +40,29 @@ const initialQuery = {
type: 'ITINERARY'
}

const history = createHashHistory()
const middleware = [
thunk,
routerMiddleware(history) // for dispatching history actions
]

// check if app is being run in development mode. If so, enable redux-logger
if (process.env.NODE_ENV === 'development') {
middleware.push(createLogger())
}

// set up the Redux store
const store = createStore(
combineReducers({
otp: createOtpReducer(otpConfig) // add optional initial query here
// add your own reducers if you want
otp: createOtpReducer(otpConfig),
router: connectRouter(history)
}),
applyMiddleware(thunk, createLogger())
compose(applyMiddleware(...middleware))
)

// define a simple responsive UI using Bootstrap and OTP-RR
class OtpRRExample extends Component {
render () {

/** desktop view **/
const desktopView = (
<div className='otp'>
Expand Down

0 comments on commit 8cc820e

Please sign in to comment.