How to use the found/lib/createBrowserRouter function in found

To help you get started, we’ve selected a few found 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 4Catalyzer / found / examples / hot-reloading / src / BrowserRouter.js View on Github external
import createBrowserRouter from 'found/lib/createBrowserRouter';
import React from 'react';
import { hot } from 'react-hot-loader';

import routeConfig from './routeConfig';

const BrowserRouter = createBrowserRouter({
  routeConfig,

  /* eslint-disable react/prop-types */
  renderError: ({ error }) => (
    <div>{error.status === 404 ? 'Not found' : 'Error'}</div>
  ),
  /* eslint-enable react/prop-types */
});

export default hot(module)(BrowserRouter);
github 4Catalyzer / found / examples / global-pending / src / index.js View on Github external
<ul>
        Main
        <ul>
          Foo
          Bar
        </ul>
      </ul>

      {children}
    
  );
}

App.propTypes = propTypes;

const BrowserRouter = createBrowserRouter({
  routeConfig: [
    {
      path: '/',
      Component: App,
      children: [
        {
          Component: () =&gt; <div>Main</div>,
        },
        {
          path: 'foo',
          getComponent: () =&gt;
            new Promise(resolve =&gt; {
              setTimeout(resolve, 1000, () =&gt; <div>Foo</div>);
            }),
        },
        {
github 4Catalyzer / found / examples / transition-hook / src / index.js View on Github external
<button type="button">
              Yes
            </button>
            <button type="button">
              No
            </button>
          
        )}
      
    );
  }
}

Main.propTypes = mainPropTypes;

const BrowserRouter = createBrowserRouter({
  historyOptions: { useBeforeUnload: true },

  routeConfig: [
    {
      path: '/',
      Component: App,
      children: [
        {
          Component: Main,
        },
        {
          path: 'other',
          Component: () =&gt; <div>Other</div>,
        },
      ],
    },
github 4Catalyzer / found / examples / basic-jsx / src / index.js View on Github external
<ul>
          Foo
          Bar (async)
          Baz (redirects to Foo)
          Qux (missing)
        </ul>
      

      {children}
    
  );
}

App.propTypes = propTypes;

const BrowserRouter = createBrowserRouter({
  routeConfig: makeRouteConfig(
    
       <div>Main</div>} /&gt;
       <div>Foo</div>} /&gt;
      
          new Promise(resolve =&gt; {
            setTimeout(resolve, 1000, ({ data }) =&gt; <div>{data}</div>);
          })
        }
        getData={() =&gt;
          new Promise(resolve =&gt; {
            setTimeout(resolve, 1000, 'Bar');
          })
        }
github 4Catalyzer / found / examples / basic / src / index.js View on Github external
<ul>
          Foo
          Bar (async)
          Baz (redirects to Foo)
          Qux (missing)
        </ul>
      

      {children}
    
  );
}

App.propTypes = propTypes;

const BrowserRouter = createBrowserRouter({
  routeConfig: [
    {
      path: '/',
      Component: App,
      children: [
        {
          Component: () =&gt; <div>Main</div>,
        },
        {
          path: 'foo',
          Component: () =&gt; <div>Foo</div>,
        },
        {
          path: 'bar',
          getComponent: () =&gt;
            new Promise(resolve =&gt; {