<commit_before>// 根文件
import React from 'react'
import { render } from 'react-dom'

// import { createDevTools }                       from 'redux-devtools'
// import LogMonitor                               from 'redux-devtools-log-monitor'
// import DockMonitor                              from 'redux-devtools-dock-monitor'

// import { createStore, combineReducers }         from 'redux'
import { createStore, combineReducers, applyMiddleware, compose } from 'redux'
import { Provider } from 'react-redux'

import thunk                                    from 'redux-thunk'          // 异步

import DevTools                                 from './containers/DevTools' // redux-devtools 工具

// router
// import { Router, BrowserRouter }                from 'react-router'
import createHistory                            from 'history/createBrowserHistory'
import { Route }                                from 'react-router-dom'

// router-redux
// import { syncHistoryWithStore, routerReducer }  from 'react-router-redux'
import {
    ConnectedRouter,
    routerReducer,
    routerMiddleware
    // ,push
} from 'react-router-redux'

import rootReducer                              from './store/reducers'         // 根 reducers
// import Routes                                   from './router'                 // 根 路由配置

// 临时测试 子页面
import App from './containers/App'
import Foo from './containers/Foo'
import Bar from './containers/Bar'

// Create a history of your choosing (we're using a browser history in this case)
const history = createHistory()

// Build the middleware for intercepting and dispatching navigation actions
const middleware = routerMiddleware(history)


// redux-devtools
const enhancer = compose(
    // 你要使用的中间件，放在前面
    applyMiddleware(thunk),
    // 必须的！启用带有monitors（监视显示）的DevTools
    DevTools.instrument()
)

export default function createStoreWithMiddleware (initialState) {
    // 注意：仅仅只有redux>=3.1.0支持第三个参数
    const store = createStore(rootReducer, initialState, enhancer)
    return store
}


// react-router-redux 4.x
// const reducer = combineReducers({
//     ...rootReducer,
//     routing: routerReducer
// })
// redux
// const store = createStore(
//     reducer,
//     DevTools.instrument()
// )

// react-router-redux 5.x
// Add the reducer to your store on the `router` key
// Also apply our middleware for navigating
const store = createStore(
    combineReducers({
        ...rootReducer,
        router: routerReducer
    }),
    applyMiddleware(middleware)
)

// redux-devtools
// const DevTools = createDevTools(
//     <DockMonitor toggleVisibilityKey="ctrl-h" changePositionKey="ctrl-q">
//         <LogMonitor theme="tomorrow" preserveScrollTop={false} />
//     </DockMonitor>
// )

// router
// const history = syncHistoryWithStore(BrowserRouter, store)

const rootElement = document.getElementById('root')

render(
    <Provider store={ store }>
        {/*
            <Router history={ history }>
                <Routes />
            </Router>
        */}
        <ConnectedRouter history={ history }>
            <div>
                <Route exact path="/" component={ App } />
                <Route path="/about" component={ Foo } />
                <Route path="/topics" component={ Bar } />
            </div>
        </ConnectedRouter>
    </Provider>,
    rootElement
)<commit_msg>:art: 合并冲突<commit_after>// 根文件
import React from 'react'
import { render } from 'react-dom'

// import { createDevTools }                       from 'redux-devtools'
// import LogMonitor                               from 'redux-devtools-log-monitor'
// import DockMonitor                              from 'redux-devtools-dock-monitor'

// import { createStore, combineReducers }         from 'redux'
import { createStore, combineReducers, applyMiddleware, compose } from 'redux'
import { Provider } from 'react-redux'

import thunk                                    from 'redux-thunk'          // 异步

import DevTools                                 from './containers/DevTools' // redux-devtools 工具

// router
// import { Router, BrowserRouter }                from 'react-router'
import createHistory                            from 'history/createBrowserHistory'
import { Route }                                from 'react-router-dom'

// router-redux
// import { syncHistoryWithStore, routerReducer }  from 'react-router-redux'
import {
    ConnectedRouter,
    routerReducer,
    routerMiddleware
    // ,push
} from 'react-router-redux'

import rootReducer                              from './store/reducers'         // 根 reducers
// import Routes                                   from './router'                 // 根 路由配置

// 临时测试 子页面
import App from './containers/App'
import Foo from './containers/Foo'
import Bar from './containers/Bar'

// Create a history of your choosing (we're using a browser history in this case)
const history = createHistory()

// Build the middleware for intercepting and dispatching navigation actions
const middleware = routerMiddleware(history)


// redux-devtools
const enhancer = compose(
    // 你要使用的中间件，放在前面
    applyMiddleware(thunk),
    // 必须的！启用带有monitors（监视显示）的DevTools
    DevTools.instrument()
)

export default function createStoreWithMiddleware (initialState) {
    // 注意：仅仅只有redux>=3.1.0支持第三个参数
    const store = createStore(rootReducer, initialState, enhancer)
    return store
}


// react-router-redux 4.x
// const reducer = combineReducers({
//     ...rootReducer,
//     routing: routerReducer
// })
// redux
// const store = createStore(
//     reducer,
//     DevTools.instrument()
// )

// react-router-redux 5.x
// Add the reducer to your store on the `router` key
// Also apply our middleware for navigating
const store = createStore(
    combineReducers({
        ...rootReducer,
        router: routerReducer
    }),
    applyMiddleware(middleware)
)

// redux-devtools
// const DevTools = createDevTools(
//     <DockMonitor toggleVisibilityKey="ctrl-h" changePositionKey="ctrl-q">
//         <LogMonitor theme="tomorrow" preserveScrollTop={false} />
//     </DockMonitor>
// )

// router
// const history = syncHistoryWithStore(BrowserRouter, store)

const rootElement = document.getElementById('root')

render(
    <Provider store={ store }>
        {/*
            <Router history={ history }>
                <Routes />
            </Router>
        */}
        <ConnectedRouter history={ history }>
            <div>
                <Route exact path="/" component={ App } />
                <Route path="/about" component={ Foo } />
                <Route path="/topics" component={ Bar } />
                <Route path="/home" component={ Home } />
            </div>
        </ConnectedRouter>
    </Provider>,
    rootElement
)
{'fraction_non_alphanumeric': 0.11336391889891964, 'fraction_numerical': 0.001479946721918011, 'mean_word_length': 2.0441441441441444, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2300445', 'n_tokens_mistral': 1971, 'n_tokens_neox': 1945, 'n_words': 487}