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

Recommend this page to a friend!
  Classes of Arturs Sosins  >  Countly Web SDK  >  examples/react/src/App-WithEffect.js  >  Download  
File: examples/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: 2 months ago
Size: 1,071 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";
import ErrorBoundary from "./ErrorBoundary";

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

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

export default App;