Last active
November 21, 2017 07:42
-
-
Save anjum121/a2742df32c4d3f39553685a9b885643f to your computer and use it in GitHub Desktop.
React, Redux, ITunes Music search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { render } from 'react-dom' | |
import { Provider } from 'react-redux' | |
import { ConnectedRouter } from 'react-router-redux' | |
import store, { history } from './store/Store' | |
import App from './containers/app' | |
import './theme/App.css' | |
const target = document.querySelector('#root') | |
render( | |
<Provider store={store}> | |
<ConnectedRouter history={history}> | |
<div> | |
<App /> | |
</div> | |
</ConnectedRouter> | |
</Provider>, | |
target | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "itunes-react-redux", | |
"version": "0.1.0", | |
"private": true, | |
"dependencies": { | |
"axios": "0.16.2", | |
"moment": "2.19.1", | |
"react": "^16.0.0", | |
"react-dom": "^16.0.0", | |
"react-redux": "5.0.6", | |
"react-router-dom": "4.2.2", | |
"react-router-redux": "5.0.0-alpha.8", | |
"react-scripts": "1.0.14", | |
"redux": "3.7.2", | |
"redux-thunk": "2.2.0" | |
}, | |
"scripts": { | |
"build-css": "node-sass-chokidar src/ -o src/", | |
"watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive", | |
"start": "react-scripts start", | |
"build": "react-scripts build", | |
"test": "react-scripts test --env=jsdom", | |
"eject": "react-scripts eject" | |
}, | |
"devDependencies": { | |
"node-sass-chokidar": "0.0.3" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {createStore, applyMiddleware, compose} from 'redux' | |
import {routerMiddleware} from 'react-router-redux' | |
import thunk from 'redux-thunk' | |
import createHistory from 'history/createBrowserHistory' | |
import rootReducer from '../modules' | |
export const history = createHistory() | |
const initialState = {} | |
const enhancers = [] | |
const middleware = [ | |
thunk, | |
routerMiddleware(history) | |
] | |
if (process.env.NODE_ENV === 'development') { | |
const devToolsExtension = window.devToolsExtension | |
if (typeof devToolsExtension === 'function') { | |
enhancers.push(devToolsExtension()) | |
} | |
} | |
const composedEnhancers = compose( | |
applyMiddleware(...middleware), | |
...enhancers | |
) | |
const store = createStore( | |
rootReducer, | |
initialState, | |
composedEnhancers | |
) | |
export default store |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment