Skip to content

Commit

Permalink
Abstrayendo React Router, creando history y haciendo initialState mas…
Browse files Browse the repository at this point in the history
… accesible
  • Loading branch information
MauroBrandan committed Aug 9, 2021
1 parent 37a29f4 commit a4634a1
Show file tree
Hide file tree
Showing 6 changed files with 263 additions and 179 deletions.
168 changes: 0 additions & 168 deletions initialState.json

This file was deleted.

49 changes: 40 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
"dependencies": {
"dotenv": "^10.0.0",
"express": "^4.17.1",
"history": "^5.0.0",
"md5": "^2.3.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-hot-loader": "^4.13.0",
"react-redux": "^7.2.4",
"react-router-config": "^5.1.1",
"react-router-dom": "^5.2.0",
"redux": "^4.1.1",
"webpack": "^5.49.0",
Expand Down
9 changes: 7 additions & 2 deletions src/frontend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@ import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import { createStore, compose } from 'redux'
import { Router } from 'react-router-dom'
import { createBrowserHistory } from 'history'

import reducer from './reducers'
import App from './routes/App'
import { initialState } from '../../initialState.json'
import initialState from './initialState'

const history = createBrowserHistory()
const container = document.getElementById('app')
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const store = createStore(reducer, initialState, composeEnhancers())

ReactDOM.render(
<Provider store={store}>
<App />
<Router history={history}>
<App />
</Router>
</Provider>,
container
)
Loading

0 comments on commit a4634a1

Please sign in to comment.