How to use the history.createHashHistory function in history

To help you get started, we’ve selected a few history examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github prooph / event-store-mgmt-ui / src / index.tsx View on Github external
//                 Object
//                     .keys(res[lang])
//                     .forEach((namespace) => {
//                         i18next.addResourceBundle(lang, namespace, res[lang][namespace], true, true );
//                     })
//                 ;
//             })
//         ;
//
//         module.hot.emit('loaded');
//     });
// }

const sagaMiddleware = createSagaMiddleware();

const history = createHashHistory();

const initialState = INITIAL_STATE.set(PATH_MESSAGE_FLOW, loadMessageFlow())
    .setIn(WATCHERS_PATH, loadWatchers());

console.log("initial state", initialState.toJSON());

const store = createStore(
    reducer,
    initialState,
    composeWithDevTools(
        applyMiddleware(sagaMiddleware) as StoreEnhancer,
    ) as StoreEnhancer,
);

//Register localStorage sync
store.subscribe(() => {
github Wscats / react-tutorial / react+webpack+react-router+redux / app / components / basic.jsx View on Github external
import React from 'react';
import {BrowserRouter as Router, Route, Link, Redirect, HashRouter} from 'react-router-dom'
import {createBrowserHistory, createHashHistory} from 'history'
const history = createHashHistory()
//引入组件
import Home from "./home.jsx";
import Topics from "./topics.jsx";
import About from "./about.jsx";
import {ButtonGroup, Button} from 'react-bootstrap';

import {increaseAction, multiAction} from '../action.js';

import {connect} from 'react-redux';

import {Tab, Tabs} from 'react-bootstrap';

// React component
class Basic extends React.Component {
  constructor(props) {
    super(props);
github MovieCast / desktop / app / shared / store / configureStore.dev.js View on Github external
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import { createHashHistory } from 'history';
import { routerMiddleware, routerActions } from 'react-router-redux';
import { createLogger } from 'redux-logger';
import rootReducer from '../reducers';
import * as electronActions from '../actions/electron';
import * as settingsActions from '../actions/settings';
import * as itemsActions from '../actions/items';

const history = createHashHistory();

const configureStore = (initialState) => {
  // Redux Configuration
  const middleware = [];
  const enhancers = [];

  // Thunk Middleware
  middleware.push(thunk);

  // Logging Middleware
  const logger = createLogger({
    level: 'info',
    collapsed: true
  });
  middleware.push(logger);
github foxfolio / foxfolio-desktop / app / store / configureStore.prod.js View on Github external
// @flow
import type { Store } from 'redux';
import { applyMiddleware, compose, createStore } from 'redux';
import thunk from 'redux-thunk';
import { createHashHistory } from 'history';
import { routerMiddleware } from 'react-router-redux';

import type { GlobalState } from '../reducers';
import rootReducer from '../reducers';
import { persistStore } from './persistStore';
import type { Dispatch } from '../actions/action.d';

const history = createHashHistory();

const router = routerMiddleware(history);
const enhancer = compose(applyMiddleware(thunk, router));

function configureStore(initialState?: GlobalState): Store<*, *, Dispatch> {
  const store = createStore(rootReducer, initialState, enhancer);
  persistStore(store);
  return store;
}

export default { configureStore, history };
github lbryio / lbry-desktop / ui / store.js View on Github external
createCompressor(),
];

const persistOptions = {
  key: 'v0',
  storage: localForage,
  stateReconciler: autoMergeLevel2,
  whitelist: whiteListedReducers,
  // Order is important. Needs to be compressed last or other transforms can't
  // read the data
  transforms,
};

let history;
// @if TARGET='app'
history = createHashHistory();
// @endif
// @if TARGET='web'
history = createBrowserHistory();
// @endif

const triggerSharedStateActions = [
  ACTIONS.CHANNEL_SUBSCRIBE,
  ACTIONS.CHANNEL_UNSUBSCRIBE,
  LBRY_REDUX_ACTIONS.TOGGLE_TAG_FOLLOW,
  LBRY_REDUX_ACTIONS.TOGGLE_BLOCK_CHANNEL,
  LBRY_REDUX_ACTIONS.CREATE_CHANNEL_COMPLETED,
  LBRY_REDUX_ACTIONS.SHARED_PREFERENCE_SET,
];

/**
 * source: the reducer name
github chenliang2016 / CLReactAntDesign / IceBackend / LmmIceBackend / src / pages / Auth / components / UserLogin / UserLogin.jsx View on Github external
import React, { Component } from 'react';
import { Input, Button, Checkbox, Grid, Feedback } from '@icedesign/base';
import {
  FormBinderWrapper as IceFormBinderWrapper,
  FormBinder as IceFormBinder,
  FormError as IceFormError,
} from '@icedesign/form-binder';
import IceIcon from '@icedesign/icon';
import './UserLogin.scss';

const { Row, Col } = Grid;

import lmmNet from '../../../../utils/lmmNet'

import { createHashHistory } from 'history';
const hashHistory = createHashHistory();

// 寻找背景图片可以从 https://unsplash.com/ 寻找
const backgroundImage =
  'https://img.alicdn.com/tfs/TB1zsNhXTtYBeNjy1XdXXXXyVXa-2252-1500.png';

const loopTreeData = (data, pid) => {
    var result = [], temp;
    for (var i = 0; i < data.length; i++) {
        if (data[i].pmenuId == pid) {
            var obj = {
                "id":data[i].menuId,
                "pid":data[i].pmenuId,
                "title": data[i].name,
                "key":data[i].menuKey,
                "tag":data[i].tag,
                "icon":data[i].icon,
github mingchia-andy-liu / chrome-extension-nba / src / app / store.js View on Github external
import { createStore, applyMiddleware, compose } from 'redux'
import thunk from 'redux-thunk'
import { routerMiddleware } from 'react-router-redux'
import { createHashHistory } from 'history'
import reducer, { initialState } from './reducers'

export const history = createHashHistory({
    basname: '',
    hashType: 'slash',
})

const middleware = routerMiddleware(history)
let middlewares
if (process.env.NODE_ENV === 'development') {
    const DevTools = require('./devTools')
    middlewares = compose(
        applyMiddleware(thunk, middleware),
        // Required! Enable Redux DevTools with the monitors you chose
        DevTools.default.instrument()
    )
} else {
    middlewares = compose(applyMiddleware(thunk, middleware))
}
github amovah / speedster / src / history.js View on Github external
import { createHashHistory } from 'history';
import changeActiveMenu from 'Root/actions/activeMenu/change';

const history = createHashHistory();

history.listen((location) => {
  changeActiveMenu(location.pathname);
});

if (process.env.NODE_ENV === 'development') {
  global.myHistory = history;
}

export default history;
github l3p-cv / lost / frontend / lost / src / components / DefaultLayout / SubContainers / AccountDropdown.js View on Github external
import React, {Component} from 'react'
import {DropdownItem, DropdownMenu, DropdownToggle} from 'reactstrap'
import {AppHeaderDropdown} from '@coreui/react'
import {connect} from 'react-redux'
import {createHashHistory} from 'history'
import actions from '../../../actions'

const history = createHashHistory()
const {getOwnUser} = actions

class AccountDropdown extends Component {
    constructor(props){
        super(props)
        this.state = {
            user_name: '',
            first_name: '',
            last_name: '',
            email: ''
        }
        this.callback = this.callback.bind(this)
    }
    componentDidMount(){
        this.props.getOwnUser(this.callback)
    }