File: samples/react/src/App-WithEffect.js

Recommend this page to a friend!
  Classes of Arturs Sosins  >  Countly Web SDK  >  samples/react/src/App-WithEffect.js  >  Download  
File: samples/react/src/App-WithEffect.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Countly Web SDK
Track site accesses and errors the Countly API
Author: By
Last change:
Date: 6 months ago
Size: 815 bytes
 

Contents

Class file image Download
import React, { useState } from 'react';
import {
  BrowserRouter as Router,
  Switch,
  Route
} from "react-router-dom";

import Home from './Components/Home';
import Contact from './Components/Contact';
import Header from './Components/Header';

import Location from './Location-WithEffect';

const App = () => {
  const [loginState, setLoginState] = useState(localStorage.getItem("clydemo-login-state") ? true: false);

  return (
    <Router basename={`${process.env.PUBLIC_URL}`}>
      <Location>
        <Header loginState={loginState} setLoginState={setLoginState} />
        <Switch>
          <Route path="/contact">
            <Contact />
          </Route>
          <Route path="/">
            <Home />
          </Route>
        </Switch>
      </Location>
    </Router>
  );
}

export default App;