connected-react-router#ConnectedRouter TypeScript Examples

The following examples show how to use connected-react-router#ConnectedRouter. 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: safe.dom.utils.tsx    From multisig-react with MIT License 7 votes vote down vote up
renderApp = (store) => ({
  ...render(
    <Provider store={store}>
      <ConnectedRouter history={history}>
        <App>
            {wrapInSuspense(<AppRoutes />, <div />)}
        </App>
      </ConnectedRouter>
    </Provider>,
  ),
  history,
})
Example #2
Source File: Entry.tsx    From mops-vida-pm-watchdog with MIT License 6 votes vote down vote up
Entry: React.FC = () => (
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <Switch>
        <Route exact path='/' component={SensorConsole} />
      </Switch>
    </ConnectedRouter>
  </Provider>
)
Example #3
Source File: index.tsx    From rusty-chat with MIT License 6 votes vote down vote up
ReactDOM.render(
    <React.StrictMode>
        <CssBaseline/>
        <Provider store={store}>
            <ConnectedRouter history={history}>
                <App/>
            </ConnectedRouter>
        </Provider>
    </React.StrictMode>,
    document.getElementById('root'),
);
Example #4
Source File: Root.tsx    From memex with MIT License 6 votes vote down vote up
render() {
    const { store, history } = this.props;
    return (
      <Provider store={store}>
        <ConnectedRouter history={history}>
          <Routes />
        </ConnectedRouter>
      </Provider>
    );
  }
Example #5
Source File: Root.tsx    From deskreen with GNU Affero General Public License v3.0 6 votes vote down vote up
Root = ({ store, history }: Props) => {
  const [, setAppLanguage] = useState('');

  useEffect(() => {
    i18n.on('languageChanged', (lng) => {
      setAppLanguage(lng);
    });
  }, []);

  return (
    <Provider store={store}>
      <SettingsProvider>
        <ConnectedRouter history={history}>
          <Routes />
        </ConnectedRouter>
      </SettingsProvider>
    </Provider>
  );
}
Example #6
Source File: App.controller.tsx    From tezos-link with Apache License 2.0 6 votes vote down vote up
App = ({ history }: AppProps) => {
  return (
    <>
      <ConnectedRouter history={history}>
        <Header />
        <Drawer />
        <Hamburger />
        <AppView />
        <Toaster />
        <ProgressBar />
      </ConnectedRouter>
    </>
  )
}
Example #7
Source File: App.controller.tsx    From tezos-academy with MIT License 6 votes vote down vote up
App = () => (
  <ConnectedRouter history={history}>
    <AppBg>
      <Header />
      <Drawer />
      <Hamburger />
      <AppView />
      <Toaster />
      <ProgressBar />
    </AppBg>
  </ConnectedRouter>
)
Example #8
Source File: index.tsx    From nouns-monorepo with GNU General Public License v3.0 6 votes vote down vote up
ReactDOM.render(
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <ChainSubscriber />
      <React.StrictMode>
        <Web3ReactProvider
          getLibrary={
            provider => new Web3Provider(provider) // this will vary according to whether you use e.g. ethers or web3.js
          }
        >
          <ApolloProvider client={client}>
            <PastAuctions />
            <DAppProvider config={useDappConfig}>
              <LanguageProvider>
                <App />
              </LanguageProvider>
              <Updaters />
            </DAppProvider>
          </ApolloProvider>
        </Web3ReactProvider>
      </React.StrictMode>
    </ConnectedRouter>
  </Provider>,
  document.getElementById('root'),
);
Example #9
Source File: index.tsx    From idena-pocket with MIT License 6 votes vote down vote up
ReactDOM.render(
	<Provider store={store}>
		<GlobalStyle />
		<ConnectedRouter history={history}>
			<Switch>
				<Route exact path='/' component={Login} />
				<Route path='/import-mnemonic' component={ImportMnemonic} />
				<Route path='/create-wallet' component={CreateWallet} />
				<Route path='/show-created-seed' component={ShowCreatedSeed} />
				<Route path='/confirm-seed' component={ConfirmSeed} />
				<Route path='/unlocked'>
					<Unlocked>
						<Route path='/'>
							<Redirect to='/unlocked/profile' />
						</Route>
						<Route path='/unlocked/profile' component={Settings} />
						<Route path='/unlocked/send' component={SendTx} />
						<Route
							path='/unlocked/transactions'
							component={Transations}
						/>
					</Unlocked>
				</Route>
			</Switch>
		</ConnectedRouter>
	</Provider>,
	document.getElementById('root')
)
Example #10
Source File: safe.dom.load.tsx    From multisig-react with MIT License 6 votes vote down vote up
renderLoadSafe = async (localStore) => {
  const web3 = getWeb3()
  const provider = await getProviderInfo(web3)
  const walletRecord = makeProvider(provider)
  localStore.dispatch(addProvider(walletRecord))

  return render(
    <Provider store={localStore}>
      <ConnectedRouter history={history}>
        <Load />
      </ConnectedRouter>
    </Provider>,
  )
}
Example #11
Source File: safe.dom.create.tsx    From multisig-react with MIT License 6 votes vote down vote up
renderOpenSafeForm = async (localStore) => {
  const web3 = getWeb3()
  const provider = await getProviderInfo(web3)
  const walletRecord = makeProvider(provider)
  localStore.dispatch(addProvider(walletRecord))

  return render(
    <Provider store={localStore}>
      <ConnectedRouter history={history}>
        <Open />
      </ConnectedRouter>
    </Provider>,
  )
}
Example #12
Source File: index.tsx    From multisig-react with MIT License 6 votes vote down vote up
Root = (): React.ReactElement => (
  <ThemeProvider theme={styledTheme}>
    <Provider store={store}>
      <MuiThemeProvider theme={theme}>
        <ConnectedRouter history={history}>
          <Sentry.ErrorBoundary fallback={GlobalErrorBoundary}>
            <App>{wrapInSuspense(<AppRoutes />, <Loader />)}</App>
          </Sentry.ErrorBoundary>
        </ConnectedRouter>
      </MuiThemeProvider>
    </Provider>
  </ThemeProvider>
)
Example #13
Source File: App.tsx    From che-dashboard-next with Eclipse Public License 2.0 6 votes vote down vote up
function AppComponent(props: { history: History }): React.ReactElement {
  return (
    <ConnectedRouter history={props.history}>
      <Head />
      <Layout history={props.history}>
        <AppAlertGroup />
        <Suspense fallback={Fallback}>
          <Switch>
            <Routes />
            <Redirect path='*' to='/' />
          </Switch>
        </Suspense>
      </Layout>
    </ConnectedRouter>
  );
}
Example #14
Source File: App.tsx    From msteams-meetings-template with MIT License 6 votes vote down vote up
function App() {
  return (
    <Provider store={store}>
      <ConnectedRouter history={hist}>
        <Switch>
          <Route exact path="/signin" component={SigninPage} />
          <Route exact path="/createMeeting" component={MeetingPage} />
          <Route exact path="/copyMeeting" component={CopyMeetingPage} />
          <Route exact path="/error" component={ErrorPage} />
          <Route component={CreateLandingPage} />
        </Switch>
      </ConnectedRouter>
    </Provider>
  );
}
Example #15
Source File: entry.tsx    From atorch-console with MIT License 6 votes vote down vote up
Entry: React.FC = () => (
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <Switch>
        <Route exact path='/' component={AtorchConsole} />
      </Switch>
    </ConnectedRouter>
  </Provider>
)
Example #16
Source File: main.tsx    From rewind with MIT License 5 votes vote down vote up
async function initialize() {
  let api: FrontendPreloadAPI;
  if (window.api) {
    api = window.api;
  } else {
    api = {
      getAppVersion: () => Promise.resolve(environment.appVersion),
      getPlatform: () => Promise.resolve(environment.platform),
      reboot: () => console.log("Rebooting ..."),
      selectDirectory: () => Promise.resolve("C:\\Mocked\\Path"),
      selectFile: () => Promise.resolve("C:\\Mocked\\File.osr"),
      onManualReplayOpen: (listener) => console.log(`Registered a listener for opening replay files manually`),
    };
  }
  const [appVersion, platform] = await Promise.all([api.getAppVersion(), api.getPlatform()]);
  const appInfo = { appVersion, platform };

  console.log(`Initializing with version=${appVersion} on platform=${platform}`);

  api.onManualReplayOpen((file) => {
    // todo: refactor
    // Changes to the analyzer page
    store.dispatch(push("/analyzer"));
    theater.analyzer.loadReplay(`local:${file}`);
  });

  ReactDOM.render(
    <StrictMode>
      <AppInfoProvider appInfo={appInfo}>
        <Provider store={store}>
          <ConnectedRouter history={history}>
            <ThemeProvider theme={RewindTheme}>
              <CssBaseline />
              <TheaterProvider theater={theater}>
                <RewindApp />
              </TheaterProvider>
            </ThemeProvider>
          </ConnectedRouter>
        </Provider>
      </AppInfoProvider>
    </StrictMode>,
    document.getElementById("root"),
  );

  // This starts off with /splash -> Maybe do it somewhere else?
  store.dispatch(push("/splash"));
}
Example #17
Source File: router.tsx    From reactant with MIT License 5 votes vote down vote up
ConnectedRouter: FunctionComponent = (props) => (
    <ConnectedRouter history={this.history}>{props.children}</ConnectedRouter>
  );
Example #18
Source File: router.tsx    From reactant with MIT License 5 votes vote down vote up
provider = (props: PropsWithChildren<any>) => {
    if (!this.autoProvide) return <>{props.children}</>;
    return <this.ConnectedRouter>{props.children}</this.ConnectedRouter>;
  };