connected-react-router#ConnectedRouter JavaScript 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: app.js    From horondi_admin with MIT License 6 votes vote down vote up
App = () => {
  const darkMode = useSelector(({ Theme }) => Theme.darkMode);
  const themeMode = darkMode ? DARK_THEME : LIGHT_THEME;
  const themeValue = theme(themeMode);
  const classes = useStyles();
  const dispatch = useDispatch();
  const validatorMethods = useDeleteValidation(
    getAllProductsDataForDeleteValidation
  );
  const token = getFromLocalStorage(LOCAL_STORAGE.AUTH_ACCESS_TOKEN);

  useEffect(() => {
    dispatch(checkUserByToken());

    if (token) {
      dispatch(getEmailQuestionsPendingCount());
    }
  }, []);

  return (
    <ThemeProvider theme={themeValue}>
      <CssBaseline>
        <div className={classes.root}>
          <ConnectedRouter history={history}>
            <Routes validatorMethods={validatorMethods} />
          </ConnectedRouter>
        </div>
      </CssBaseline>
    </ThemeProvider>
  );
}
Example #2
Source File: App.jsx    From react-14.01 with MIT License 6 votes vote down vote up
render() {
        return (
            <Provider store={store}>
                <PersistGate loading={null} persistor={persistor}>
                    <ConnectedRouter history={history}>
                        <InstallPopup />
                        <Switch >
                            <Route path='/profile' exact component={ProfileContainer}></Route>
                            <Route path='/chats/:id' exact component={ChatContainer} />
                            <Route path='/chats' exact component={ChatListContainer}></Route>
                        </Switch>
                    </ConnectedRouter>
                </PersistGate>
            </Provider>
        )

    }
Example #3
Source File: index.js    From resumeker-fe with MIT License 6 votes vote down vote up
ReactDOM.render(
    <ApolloProvider client={client}>
        <Auth0Provider
            domain={process.env.REACT_APP_AUTH0_DOMAIN}
            client_id={process.env.REACT_APP_CLIENT_ID}
            redirect_uri={window.location.origin}
            onRedirectCallback={onRedirectCallback}
        >
            <Provider store={configStore}>
                <ConnectedRouter history={history}>
                    <App />
                </ConnectedRouter>
            </Provider>
        </Auth0Provider>
    </ApolloProvider>,
    document.getElementById("root")
);
Example #4
Source File: App.jsx    From react-14.01 with MIT License 6 votes vote down vote up
render() {
        return (
            <Provider store={store}>
                <ConnectedRouter history={history}>
                    <ChatListContainer />
                    <Switch>
                        <Route path="/chats/" exact component={ChatContainer} />
                        <Route path="/chats/:id" exact component={ChatContainer} />
                        <Route path="/about">
                            It's about
                </Route>
                        <Route path="/home">
                            It's home
                </Route>
                        <Route path="/">
                            It's 404
                </Route>
                    </Switch>
                </ConnectedRouter>
            </Provider>
        )
    }
Example #5
Source File: index.jsx    From agent with MIT License 6 votes vote down vote up
ReactDOM.render(
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <Switch>
        <Route path="/login" component={RequireGuest(Login)} />
        <App>
          <Route exact path="/" component={RequireAuth(Dashboard)} />
          <Route exact path="/dashboard" component={RequireAuth(Dashboard)} />
          <Route exact path="/" render={() => <Redirect to="/dashboard" />} />
          <Route exact path="/media" component={RequireAuth(Media)} />
          <Route exact path="/settings" component={RequireAuth(Settings)} />
        </App>
      </Switch>
    </ConnectedRouter>
  </Provider>,
  document.getElementById('root')
);
Example #6
Source File: index.js    From github-azure-demo with MIT License 6 votes vote down vote up
ReactDOM.render(
    <Provider store={store}>
        <ConnectedRouter history={history}>
            <Switch>
                <Route path="/" component={App} />
            </Switch>
        </ConnectedRouter>
    </Provider>,

    document.getElementById("root")
);
Example #7
Source File: App.js    From loopring-pay with Apache License 2.0 6 votes vote down vote up
render() {
    return (
      <UserPreferenceContext.Provider value={this.props.userPreferences}>
        <ThemeProvider theme={this.props.userPreferences.theme}>
          <BrowserGlobalStyles />
          <AntdGlobalStyles />
          <AntdTableStyles />
          <AntdFormStyles />
          <AntdModalStyles />
          <AppClassStyles />
          <WalletConnectStyles />
          <Suspense fallback={null}>
            <ConnectedRouter history={history}>{routes}</ConnectedRouter>
          </Suspense>
        </ThemeProvider>
      </UserPreferenceContext.Provider>
    );
  }
Example #8
Source File: app.js    From bank-client with MIT License 6 votes vote down vote up
ConnectedApp = ({ messages }) => (
  <Provider store={store}>
    <LanguageProvider messages={messages}>
      <ConnectedRouter history={history}>
        <HelmetProvider>
          <App />
        </HelmetProvider>
      </ConnectedRouter>
    </LanguageProvider>
  </Provider>
)
Example #9
Source File: Root.dev.js    From mern-stack with MIT License 6 votes vote down vote up
Root = ({ store, history }) => {
  return (
    <Provider store={store}>
      <ConnectedRouter history={history}>
        <ThemeProvider theme={theme}>
          <App />
        </ThemeProvider>
      </ConnectedRouter>
    </Provider>
  );
}
Example #10
Source File: render.js    From tunnel-tool with MIT License 6 votes vote down vote up
render = ({
  App,
  watchers,
  reducers,
  urls: { graphql, events }
}) => {
  const { store, history } = configureStore({
    reducers,
    initState: window.__PRELOADED_STATE__
  });
  const client = configureGraph({
    url: graphql,
    initState: window.__APOLLO_STATE__
  });

  const AppRoot = () => {
    return (
      <ApolloProvider client={client}>
        <Provider store={store}>
          <ConnectedRouter history={history}>
            <App />
          </ConnectedRouter>
        </Provider>
        <ToastContainer />
        <SocketContainer client={client} events={events} />
      </ApolloProvider>
    );
  };

  hydrate(<AppRoot />, document.getElementById("root"));
}
Example #11
Source File: Root.dev.js    From xmrig-workers with GNU General Public License v3.0 6 votes vote down vote up
Root = ({ store, history }) => (
  <Provider store={store}>
    <div>
      <ConnectedRouter history={history}>
        {routes()}
      </ConnectedRouter>
      <DevTools />
    </div>
  </Provider>
)
Example #12
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 #13
Source File: App.jsx    From react-03.03 with MIT License 6 votes vote down vote up
App = () => {
    return (
        <Provider store={store}>
            <ConnectedRouter history={history}>
                <Switch>
                    <Route path="/" exact>It's index page</Route>
                    <Route path="/chats"> 
                        <ChatListContainer/>
                        <Switch>
                            <Route path="/chats" exact component={ChatContainer} />
                            <Route path="/chats/:id" exact component={ChatContainer} />
                        </Switch>
                    </Route>
                    <Route path="/about">It's about page</Route>
                    <Route path="/contacts">It's contacts page</Route>
                    <Route path="/">It's 404 page. Not found.</Route>
                </Switch>
            </ConnectedRouter>
        </Provider>
    )
}
Example #14
Source File: app.js    From QiskitFlow with Apache License 2.0 6 votes vote down vote up
render = messages => {
  ReactDOM.render(
    <Provider store={store}>
      <LanguageProvider messages={messages}>
        <ConnectedRouter history={history}>
          <App />
        </ConnectedRouter>
      </LanguageProvider>
    </Provider>,
    MOUNT_NODE,
  );
}
Example #15
Source File: Root.js    From juggernaut-desktop with MIT License 6 votes vote down vote up
Root = ({ store, history }) => (
  <ThemeProvider options={defaultTheme}>
    <Provider store={store}>
      <DialogQueue dialogs={queue.dialogs} preventOutsideDismiss />
      <ConnectedRouter history={history}>
        <Routes />
      </ConnectedRouter>
    </Provider>
  </ThemeProvider>
)
Example #16
Source File: Root.js    From NoteMaster with GNU General Public License v3.0 6 votes vote down vote up
Root = ({ store, history }: Props) => (
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <ThemeProvider theme={theme}>
        <Routes />
      </ThemeProvider>
    </ConnectedRouter>
  </Provider>
)
Example #17
Source File: App.js    From dexwebapp with Apache License 2.0 6 votes vote down vote up
render() {
    return (
      <TrackerProvider tracker={tracker}>
        <UserPreferenceContext.Provider value={this.props.userPreferences}>
          <ThemeProvider theme={this.props.userPreferences.theme}>
            <BrowserGlobalStyles />
            <AntdGlobalStyles />
            <AntdTableStyles />
            <AntdFormStyles />
            <AntdModalStyles />
            <AppClassStyles />
            <WalletConnectStyles />
            <Suspense fallback={null}>
              <ConnectedRouter history={history}>{routes}</ConnectedRouter>
            </Suspense>
          </ThemeProvider>
        </UserPreferenceContext.Provider>
      </TrackerProvider>
    );
  }
Example #18
Source File: index.js    From beluga with GNU General Public License v3.0 6 votes vote down vote up
// uncomment if you would like to serve the final site with service workers
// import registerServiceWorker from './registerServiceWorker';

ReactDOM.render(
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <App />
    </ConnectedRouter>
  </Provider>, document.getElementById('root'));
Example #19
Source File: index.jsx    From React-Nest-Admin with MIT License 6 votes vote down vote up
ReactDOM.render(
  <Provider store={store}>
    <PersistGate loading={null} persistor={persistor}>
      <ConnectedRouter history={history}>
        <App />
      </ConnectedRouter>
    </PersistGate>
  </Provider>,
  document.getElementById("root")
);
Example #20
Source File: app.js    From awsboilerplate with MIT License 6 votes vote down vote up
render = messages => {
  ReactDOM.render(
    <Provider store={store}>
      <LanguageProvider messages={messages}>
        <ConnectedRouter history={history}>
          <App />
        </ConnectedRouter>
      </LanguageProvider>
    </Provider>,
    MOUNT_NODE,
  );
}
Example #21
Source File: app.js    From hackchat-client with Do What The F*ck You Want To Public License 6 votes vote down vote up
render = (messages) => {
  ReactDOM.render(
    <Provider store={store}>
      <CommunicationProvider store={store}>
        <LanguageProvider messages={messages}>
          <ConnectedRouter history={history}>
            <App />
          </ConnectedRouter>
        </LanguageProvider>
      </CommunicationProvider>
    </Provider>,
    MOUNT_NODE,
  );
}
Example #22
Source File: App.jsx    From react-03.03 with MIT License 6 votes vote down vote up
render(){
        return (
            <Provider store={store}>
                <ConnectedRouter history={history}>
                        <Header/>
                        <div className="MessageField">
                            <Navigation/>

                           <Switch>
                            <Route path= "/" exact component={IndexPage}></Route>
                            <Route path= "/chats/:id" exact component={ChatContainer}></Route>
                            </Switch>                 
                        </div>
                </ConnectedRouter>
            </Provider>
        );
   }
Example #23
Source File: index.js    From HexactaLabs-NetCore_React-Final with Apache License 2.0 5 votes vote down vote up
ReactDOM.render(
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <App menu={menu} />
    </ConnectedRouter>
  </Provider>,
  document.getElementById("root")
);
Example #24
Source File: index.js    From defizap-frontend with GNU General Public License v2.0 5 votes vote down vote up
ReactDOM.render(
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <App history={history} />
    </ConnectedRouter>
  </Provider>,
  rootElement
);
Example #25
Source File: Root.js    From brisque-2.0-desktop with MIT License 5 votes vote down vote up
render() {
    const { store, history } = this.props;
    return (
      <Provider store={store}>
        <ConnectedRouter history={history}>
          <Route
            render={({ location }) => (
              <div style={{ height: '100%' }}>
                <TransitionGroup className={styles.wrapper}>
                  <CSSTransition
                    key={location.pathname}
                    classNames="fade"
                    timeout={250}
                  >
                    <section
                      className={[styles.wrapperSection, 'app-router'].join(' ')}
                    >
                      <Switch location={location}>
                        <Route path="/login" component={Login} />
                        <Route path='/captcha' component={Captcha} />
                        <Route path="/app/:page?" component={ props => <App {...props} store={ store }/> } />
                        <Route path="/" render={() => <div />} />
                      </Switch>
                    </section>
                  </CSSTransition>
                </TransitionGroup>
                <div className={styles.windowHeader}>
                  {remote.process.platform === 'win32' && (
                    <div className={styles.windowControls}>
                      <Button
                        width={35}
                        height={22}
                        src={MinimizeButton}
                        hoverSrc={MinimizeButtonHover}
                        onClick={() => remote.getCurrentWindow().minimize()}
                      />
                      <Button
                        width={35}
                        height={22}
                        src={MaximizeButton}
                        hoverSrc={MaximizeButtonHover}
                        onClick={() => remote.getCurrentWindow().maximize()}
                        disabled={location.pathname !== '/app'}
                      />
                      <Button
                        width={35}
                        height={22}
                        src={CloseButton}
                        hoverSrc={CloseButtonHover}
                        onClick={() => remote.getCurrentWindow().close()}
                      />
                    </div>
                  )}
                </div>
              </div>
            )}
          />
        </ConnectedRouter>
      </Provider>
    );
  }
Example #26
Source File: Root.prod.js    From xmrig-workers with GNU General Public License v3.0 5 votes vote down vote up
Root = ({ store, history }) => (
  <Provider store={store}>
    <ConnectedRouter history={history}>
      {routes()}
    </ConnectedRouter>
  </Provider>
)
Example #27
Source File: index.js    From HexactaLabs-NetCore_React-Initial with Apache License 2.0 5 votes vote down vote up
ReactDOM.render(
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <App menu={menu} />
    </ConnectedRouter>
  </Provider>,
  document.getElementById("root")
);
Example #28
Source File: MainApp.js    From DMS_React with GNU Affero General Public License v3.0 5 votes vote down vote up
MainApp = () =>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <Switch>
        <Route path="/" component={App}/>
      </Switch>
    </ConnectedRouter>
  </Provider>
Example #29
Source File: index.js    From one-wallet with Apache License 2.0 5 votes vote down vote up
ReactDOM.render(
  <Provider store={store}>
    <ConnectedRouter history={history}>
      <Routes />
    </ConnectedRouter>
  </Provider>,
  document.getElementById('root')
)