How to use the history/lib/useQueries 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 presidential-innovation-fellows / clinical-trials-search / search / client / lib / Location.js View on Github external
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
import createHistory from 'history/lib/createBrowserHistory';
import useQueries from 'history/lib/useQueries';

const Location = canUseDOM ? useQueries(createHistory)() : {};

export default Location;
github mendersoftware / gui / node_modules / react-router / es6 / useRouterHistory.js View on Github external
return function (options) {
    var history = useQueries(useBasename(createHistory))(options);
    history.__v2_compatible__ = true;
    return history;
  };
}
github ReactTraining / react-router / modules / useRouterHistory.js View on Github external
return function (options) {
    const history = useQueries(useBasename(createHistory))(options)
    return history
  }
}
github ReactTraining / react-router / modules / useRoutes.js View on Github external
return function ({ routes, ...options } = {}) {
    const history = useQueries(createHistory)(options)
    const transitionManager = createTransitionManager(history, routes)
    return { ...history, ...transitionManager }
  }
}
github SkygearIO / skygear-doc / lib / Location.js View on Github external
/**
 * React Static Boilerplate
 * https://github.com/koistya/react-static-boilerplate
 * Copyright (c) Konstantin Tarkus (@koistya) | MIT license
 */

import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
import createHistory from 'history/lib/createBrowserHistory';
import useQueries from 'history/lib/useQueries';

const History = canUseDOM ? useQueries(createHistory)() : {};
const Window = canUseDOM ? window : undefined;
const WindowLocation = Window ? Window.location : {};

export default { History, Window, WindowLocation };
github mendersoftware / gui / node_modules / react-router / es6 / useRoutes.js View on Github external
return function () {
    var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

    var routes = _ref.routes;

    var options = _objectWithoutProperties(_ref, ['routes']);

    var history = useQueries(createHistory)(options);
    var transitionManager = createTransitionManager(history, routes);
    return _extends({}, history, transitionManager);
  };
}
github zendesk / linksf / core / history.js View on Github external
/**
 * React Static Boilerplate
 * https://github.com/kriasoft/react-static-boilerplate
 *
 * Copyright © 2015-present Kriasoft, LLC. All rights reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.txt file in the root directory of this source tree.
 */

import createBrowserHistory from 'history/lib/createBrowserHistory'
import useBeforeUnload from 'history/lib/useBeforeUnload'
import useQueries from 'history/lib/useQueries'

const history = useQueries(useBeforeUnload(createBrowserHistory))()

export default history
github SkygearIO / skygear-doc / lib / BrowserProxy.js View on Github external
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
import createHistory from 'history/lib/createBrowserHistory';
import useQueries from 'history/lib/useQueries';

let History;
let Window;
let Document;

if (canUseDOM) {
  History = useQueries(createHistory)();
  Window = window;
  Document = document;
} else {
  const emptyFunc = () => {};

  History = {
    listen: emptyFunc,
    pushState: emptyFunc,
  };

  Window = {
    pageXOffset: 0,
    pageYOffset: 0,
    location: {},

    ga: emptyFunc,
github FrontBand / react-boilerplate / app / server / page.js View on Github external
export default () => (req, res, next) => {
  if (__DEV__) {
    return res.render('index', {
      html: null,
      reduxState: null,
      inlineCss: null,
      redialProps: null,
      helmet: Helmet.rewind(),
    });
  }

  const memoryHistory = useRouterHistory(useQueries(createMemoryHistory))();
  const store = configureStore({
    history: memoryHistory,
    cookies: new CookieDough(req),
    i18n: req.i18n,
  });
  const history = syncHistoryWithStore(memoryHistory, store);
  const routes = configureRoutes({
    store,
  });
  const router = { routes };
  const historyLocation = history.createLocation(req.url);

  const { dispatch, getState } = store;

  return match({ routes: router, location: historyLocation }, (error, redirectLocation, renderProps) => { //eslint-disable-line
    if (redirectLocation) {
github insoftpub / storefront / src / core / Location.js View on Github external
* copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

import createHistory from 'history/lib/createBrowserHistory';
import createMemoryHistory from 'history/lib/createMemoryHistory';
import useQueries from 'history/lib/useQueries';

const location = useQueries(process.env.BROWSER ? createHistory : createMemoryHistory)();

export default location;