How to use @uirouter/react - 8 common examples

To help you get started, we’ve selected a few @uirouter/react 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 DestinyItemManager / DIM / src / app / router.config.ts View on Github external
export default function makeRouter() {
  const router = new UIRouterReact();
  router.plugin(servicesPlugin);
  router.plugin(hashLocationPlugin);

  // Debug visualizer
  if ($featureFlags.debugRouter) {
    // tslint:disable-next-line:no-require-imports
    router.plugin(require('@uirouter/visualizer').Visualizer);
    router.trace.enable('TRANSITION');
  }

  // Register the initial (eagerly loaded) states
  states.forEach((state) => router.stateRegistry.register(state));

  // Global config for router
  router.urlService.rules.initial({ state: 'default-account' });
  router.urlService.rules.otherwise({ state: 'default-account' });
github ui-router / react-hybrid / src / react-hybrid.tsx View on Github external
const factory = (path: [PathNode], config: ReactViewDeclaration) =>
    new ReactViewConfig(path, config);
github ui-router / react-hybrid / src / decorateUIRouterViewConfigs.ts View on Github external
    const factory = (path: [PathNode], config: ReactViewDeclaration) => new ReactViewConfig(path, config);
github ui-router / redux / examples / react / src / App.tsx View on Github external
import {
  pushStateLocationPlugin,
  UIRouterReact,
  UISref,
  UIView,
} from "@uirouter/react";
import { ConnectedUIRouter } from "@uirouter/redux/react";
import * as React from "react";
import { Provider } from "react-redux";

import createRoutedStore from "./redux/store";
import states from "./router/states";

const router = new UIRouterReact();
const store = createRoutedStore(router);

const App = () => (
  
    
      <div>
        <nav>
          <ul>
            
              <a>
                <li>home</li>
              </a></ul></nav></div>
github ui-router / react-hybrid / src / react / UIViewMonkeyPatch.tsx View on Github external
*
 * When a @uirouter/react `` is rendered (from react code),
 * it renders first to an AngularJS `` component,
 * inside the `ui-view` is an AngularJS ``,
 * which finally renders a real @uirouter/react ``:
 *
 * 
 *   
 *     
 *       
 *     
 *   
 * 
 */

UIView.prototype.render = function() {
  if (this.props.wrap === false) {
    const id = `${this.$id}/${this.props['name']}`;
    debugLog('react', 'UIViewMonkeyPatch', id, '.render()', 'realRender.apply(this, arguments)');
    return realRender.apply(this, arguments);
  }

  return ;
};
github ui-router / react-hybrid / src / react / UIViewMonkeyPatch.tsx View on Github external
import * as React from 'react';
import { UIView } from '@uirouter/react';
import { debugLog } from '../debug';
import { PortalView } from './PortalView';

const realRender = UIView.prototype.render;

/**
 * Monkey patches the @uirouter/react UIView such that:
 *
 * When a @uirouter/react `` is rendered (from react code),
 * it renders first to an AngularJS `` component,
 * inside the `ui-view` is an AngularJS ``,
 * which finally renders a real @uirouter/react ``:
 *
 * 
 *   
 *     
 *       
 *     
 *   
 * 
github ui-router / react-hybrid / src / react / ReactUIView.tsx View on Github external
import * as React from 'react';
import { UIRouterConsumer, UIView, UIViewConsumer, UIViewProps } from '@uirouter/react';
import { UIRouterContextComponent } from './UIRouterReactContext';
import { debugLog } from '../debug';

const InternalUIView = UIView.__internalViewComponent;

export interface IReactUIViewProps extends UIViewProps {
  refFn: (ref: HTMLElement) =&gt; void;
}

export const ReactUIView = ({ refFn, ...props }: IReactUIViewProps) =&gt; {
  debugLog('react', 'ReactUIView', `?/${props['name']}`, '.render()', '');

  return (
    
      
        {router =&gt; (
          
            {parentUiView =&gt; (
              
            )}
github ui-router / react / examples / typescript / index.tsx View on Github external
const routerConfig = (router: UIRouterReact) => {
  router.urlRouter.otherwise('/home');
  trace.enable(1);
};

@uirouter/react

State based routing for React

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis

Similar packages