This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { BrowserRouter, Route, Link, Switch } from 'react-router-dom'; | |
import { render } from 'react-dom'; | |
import { One, Two, Three, Four } from './Components'; | |
import { LayoutOne, LayoutTwo } from './Layouts'; | |
function App() { | |
return ( | |
<BrowserRouter> | |
<h3>Content of main App component</h3> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
const LayoutOne = ({children}) => | |
<div> | |
<h2>Layout One</h2> | |
{children} | |
</div>; | |
const LayoutTwo = ({children}) => | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
const One = () => <h1>Content of page one</h1>; | |
const Two = () => <h1>Content of page two</h1>; | |
const Three = () => <h1>Content of page three</h1>; | |
const Four = () => <h1>Content of page four</h1>; | |
export { One, Two, Three, Four }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ToastProvider } from './ToastProvider'; | |
import { useToast } from './useToast'; | |
export { ToastProvider, useToast }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useContext } from 'react'; | |
import { ToastContext } from './ToastContext'; | |
export const useToast = () => useContext(ToastContext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { useTimeout } from '../hooks/useTimeout'; | |
export const Toast = (props) => { | |
useTimeout(props.close, 5000); | |
return ( | |
<div className="toast"> | |
<div className="toast__text">{props.children}</div> | |
<div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useMemo } from 'react'; | |
import { createPortal } from 'react-dom'; | |
import { ToastContext } from './ToastContext'; | |
import { Toast } from './Toast'; | |
// Create a random ID | |
function generateUEID() { | |
let first = (Math.random() * 46656) | 0; | |
let second = (Math.random() * 46656) | 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createContext } from 'react'; | |
export const ToastContext = createContext(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { | |
HttpEvent, | |
HttpInterceptor, | |
HttpHandler, | |
HttpRequest, | |
HttpResponse | |
} from '@angular/common/http'; | |
import { Observable } from 'rxjs/Observable'; |