react-cookie#CookiesProvider JavaScript Examples

The following examples show how to use react-cookie#CookiesProvider. 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 ReactCookbook-source with MIT License 6 votes vote down vote up
function App() {
  return (
    <div className="App">
      <BrowserRouter>
        <CookiesProvider>
          <SecurityProvider>
            <Switch>
              <Route exact path="/">
                <Home />
              </Route>
              <SecureRoute path="/private1">
                <Private1 />
              </SecureRoute>
              <SecureRoute path="/private2">
                <Private2 />
              </SecureRoute>
              <Route exact path="/public">
                <Public />
              </Route>
            </Switch>
          </SecurityProvider>
        </CookiesProvider>
      </BrowserRouter>
    </div>
  )
}
Example #2
Source File: index.js    From lifebank with MIT License 6 votes vote down vote up
render(
  <ThemeProvider theme={theme}>
    <ApolloProvider client={client}>
      <CookiesProvider>
        <UserProvider>
          <CssBaseline />
          <App />
        </UserProvider>
      </CookiesProvider>
    </ApolloProvider>
  </ThemeProvider>,
  document.getElementById('root')
)
Example #3
Source File: index.js    From yasn with MIT License 6 votes vote down vote up
Connect = () => {
  const profileHook = useState(true);

  const userCookie = cookies.get('userCookie');
  const [emailDomain, setEmailDomain] = useState(
    userCookie ? userCookie.Email.split('@')[1] : ''
  );

  const [user, setUser] = useState(false);

  useEffect(() => {
    if (emailDomain === 'daiict.ac.in') setUser(true);
  }, [cookies]);

  return (
    <CookiesProvider>
      <ProfileContext.Provider value={profileHook}>
        <Suspense fallback={<Loader />}>
          <React.StrictMode>
            {user ? <AuthenticatedApp /> : <UnauthenticatedApp />}
          </React.StrictMode>
        </Suspense>
      </ProfileContext.Provider>
    </CookiesProvider>
  );
}
Example #4
Source File: routes.jsx    From howlongistheline.org with Mozilla Public License 2.0 6 votes vote down vote up
renderRoutes = () => (
  // <Provider store={store}>
    <Router history={browserHistory}>
    <MuiPickersUtilsProvider utils={MomentUtils}>
    <CookiesProvider>
    <ToastContainer />
      <Switch>
        <Route exact path="/" component={Nearme} />
        <Route exact path="/addLine" component={AddLine} />
        <Route exact path="/editLine" component={EditLine} />
        <Route exact path="/shopDetails" component={ShopDetails} />
        <Route exact path="/feedback" component={FeedBack} />
        <Route exact path="/FAQ" component={faq} />
        <Route exact path="/learntocode" component={learntocode} />
        <Route exact path="/duplicated" component={duplicated} />
        <Route exact path="/stocks" component={Stocks} />
        <Route exact path="/editLocation" component={EditLocation} />
      </Switch>
      </CookiesProvider>
      </MuiPickersUtilsProvider>
    </Router>

  // </Provider>
)
Example #5
Source File: index.js    From wedding-website with MIT License 5 votes vote down vote up
ReactDOM.render(
    <CookiesProvider>
        <StoreProvider>
            <App />
        </StoreProvider>
    </CookiesProvider>,
    document.getElementById("root")
)