history#createBrowserHistory JavaScript Examples

The following examples show how to use history#createBrowserHistory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FinancesApp.js    From actual with MIT License 6 votes vote down vote up
constructor(props) {
    super(props);
    this.history = createBrowserHistory();

    let oldPush = this.history.push;
    this.history.push = (to, state) => {
      return oldPush.call(this.history, to, makeLocationState(state));
    };

    // I'm not sure if this is the best approach but we need this to
    // globally. We could instead move various workflows inside global
    // React components, but that's for another day.
    window.__history = this.history;

    undo.setUndoState('url', window.location.href);

    this.cleanup = this.history.listen(location => {
      undo.setUndoState('url', window.location.href);
    });
  }
Example #2
Source File: react-router-dom.js    From Learning-Redux with MIT License 6 votes vote down vote up
BrowserRouter =
/*#__PURE__*/
function (_React$Component) {
  _inheritsLoose(BrowserRouter, _React$Component);

  function BrowserRouter() {
    var _this;

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
    _this.history = createBrowserHistory(_this.props);
    return _this;
  }

  var _proto = BrowserRouter.prototype;

  _proto.render = function render() {
    return React.createElement(Router, {
      history: this.history,
      children: this.props.children
    });
  };

  return BrowserRouter;
}(React.Component)
Example #3
Source File: react-router-dom.js    From spring-boot-ecommerce with Apache License 2.0 6 votes vote down vote up
BrowserRouter =
/*#__PURE__*/
function (_React$Component) {
  _inheritsLoose(BrowserRouter, _React$Component);

  function BrowserRouter() {
    var _this;

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
    _this.history = createBrowserHistory(_this.props);
    return _this;
  }

  var _proto = BrowserRouter.prototype;

  _proto.render = function render() {
    return React.createElement(Router, {
      history: this.history,
      children: this.props.children
    });
  };

  return BrowserRouter;
}(React.Component)
Example #4
Source File: helpers.jsx    From frontend-app-library-authoring with GNU Affero General Public License v3.0 6 votes vote down vote up
ctxRender = async (ui, {
  options, context, storeOptions, history = createBrowserHistory(),
} = {}) => {
  const store = buildStore({ middleware: [...getDefaultMiddleware(), spyMiddleware], ...storeOptions });
  await initializeMockApp({ messages: [appMessages] });
  return render(
    <Provider store={store}>
      <Router history={history}>
        <AppContext.Provider value={context}>
          <IntlProvider locale="en">
            {ui}
          </IntlProvider>
        </AppContext.Provider>
      </Router>
    </Provider>,
    options,
  );
}
Example #5
Source File: App.js    From TrackCOVID-community with MIT License 6 votes vote down vote up
function App () {
  const history = createBrowserHistory()
  const AppContainerWithRouter = withRouter(AppContainer)
  return (
    <Router basename={basename}>
      <AppContainerWithRouter history={history} />
    </Router>
  )
}
Example #6
Source File: CounterPage.spec.js    From brisque-2.0-desktop with MIT License 6 votes vote down vote up
function setup(initialState) {
  const store = configureStore(initialState);
  const history = createBrowserHistory();
  const provider = (
    <Provider store={store}>
      <ConnectedRouter history={history}>
        <CounterPage />
      </ConnectedRouter>
    </Provider>
  );
  const app = mount(provider);
  return {
    app,
    buttons: app.find('button'),
    p: app.find('.counter')
  };
}
Example #7
Source File: history.js    From bunk-manager-mern with MIT License 5 votes vote down vote up
history = createBrowserHistory()
Example #8
Source File: App.js    From Oud with MIT License 5 votes vote down vote up
history = createBrowserHistory()
Example #9
Source File: history.js    From fhir-app-starter with MIT License 5 votes vote down vote up
history = createBrowserHistory()
Example #10
Source File: history.js    From Changes with MIT License 5 votes vote down vote up
history =
  process.env.NODE_ENV === 'test'
    ? createMemoryHistory()
    : createBrowserHistory()
Example #11
Source File: history.js    From CyberStateRP with MIT License 5 votes vote down vote up
history = createBrowserHistory()
Example #12
Source File: RideRequestsCard.spec.js    From carpal-fe with MIT License 5 votes vote down vote up
customHistory = createBrowserHistory()
Example #13
Source File: store.js    From resumeker-fe with MIT License 5 votes vote down vote up
history = createBrowserHistory()
Example #14
Source File: router.js    From e-Pola with MIT License 5 votes vote down vote up
history = createBrowserHistory()
Example #15
Source File: history.js    From covidzero-frontend with Apache License 2.0 5 votes vote down vote up
history = createBrowserHistory()
Example #16
Source File: history.js    From Designer-Client with GNU General Public License v3.0 5 votes vote down vote up
history = createBrowserHistory({forceRefresh:true})
Example #17
Source File: index.js    From defizap-frontend with GNU General Public License v2.0 5 votes vote down vote up
history = createBrowserHistory({ basename })
Example #18
Source File: index.js    From TimesOfInternet with MIT License 5 votes vote down vote up
hist = createBrowserHistory()
Example #19
Source File: index.js    From HexactaLabs-NetCore_React-Initial with Apache License 2.0 5 votes vote down vote up
history = createBrowserHistory({ basename: baseUrl })
Example #20
Source File: index.js    From openbanking-ui with Apache License 2.0 5 votes vote down vote up
history = createBrowserHistory()
Example #21
Source File: history.js    From QiskitFlow with Apache License 2.0 5 votes vote down vote up
history = createBrowserHistory()
Example #22
Source File: configureStore.js    From dexwebapp with Apache License 2.0 5 votes vote down vote up
history = createBrowserHistory()
Example #23
Source File: index.js    From HexactaLabs-NetCore_React-Level2 with Apache License 2.0 5 votes vote down vote up
history = createBrowserHistory({ basename: baseUrl })
Example #24
Source File: store.js    From NextcloudDuplicateFinder with GNU Affero General Public License v3.0 5 votes vote down vote up
history = createBrowserHistory()
Example #25
Source File: App.js    From telar-cli with MIT License 5 votes vote down vote up
browserHistory = createBrowserHistory()
Example #26
Source File: App.js    From AzureEats-Website with MIT License 5 votes vote down vote up
history = createBrowserHistory({ basename: '' })
Example #27
Source File: ManagementApp.js    From actual with MIT License 5 votes vote down vote up
constructor(props) {
    super(props);
    this.mounted = true;
    this.history = createBrowserHistory();
    window.__history = this.history;
  }
Example #28
Source File: store.js    From Conduit-Cypress with MIT License 5 votes vote down vote up
history = createBrowserHistory()
Example #29
Source File: store.js    From beluga with GNU General Public License v3.0 5 votes vote down vote up
history = createBrowserHistory()