Skip to content

Instantly share code, notes, and snippets.

@hckhanh
Created October 12, 2019 05:20
Show Gist options
  • Save hckhanh/ccc5f342f77904aa018b4458d7b5f8dc to your computer and use it in GitHub Desktop.
Save hckhanh/ccc5f342f77904aa018b4458d7b5f8dc to your computer and use it in GitHub Desktop.
import { Router } from "@reach/router";
import { useMachine } from "@xstate/react";
import { SnackbarProvider } from "notistack";
import React from "react";
import Header from "./components/Header";
import SignIn from "./components/SignIn";
import AuthMachine from "./states/AuthMachine";
const App: React.FC = () => {
const [current, send] = useMachine(AuthMachine, { devTools: true });
console.log(current);
return (
<SnackbarProvider maxSnack={3}>
<Header />
{current.matches("authorized") && <h1>Authorized</h1>}
<Router>
<SignIn path="/login" />
</Router>
</SnackbarProvider>
);
};
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment