Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dacddf5
commit 96f3a3c
Showing
8 changed files
with
41 additions
and
215 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,48 @@ | ||
import React from 'react'; | ||
import logo from './logo.svg'; | ||
import './App.css'; | ||
import { BrowserRouter, Route, Switch, Link } from 'react-router-dom'; | ||
|
||
const HomePage = () => ( | ||
<div> | ||
<h1>Home</h1> | ||
<p>Welcome!</p> | ||
</div> | ||
); | ||
|
||
const PublicPage = () => ( | ||
<div> | ||
<h1>Public page</h1> | ||
<p>Nothing special here</p> | ||
</div> | ||
); | ||
|
||
const PrivatePage = () => ( | ||
<div> | ||
<h1>Private page</h1> | ||
<p>Wake up, Neo...</p> | ||
</div> | ||
); | ||
|
||
const App: React.FC = () => { | ||
return ( | ||
<div className="App"> | ||
<header className="App-header"> | ||
<img src={logo} className="App-logo" alt="logo" /> | ||
<p> | ||
Edit <code>src/App.tsx</code> and save to reload. | ||
</p> | ||
<a | ||
className="App-link" | ||
href="https://reactjs.org" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React | ||
</a> | ||
</header> | ||
</div> | ||
<BrowserRouter> | ||
<ul> | ||
<li> | ||
<Link to='/'>Home</Link> | ||
</li> | ||
<li> | ||
<Link to='/public'>Public</Link> | ||
</li> | ||
<li> | ||
<Link to='/private'>Private</Link> | ||
</li> | ||
</ul> | ||
<Switch> | ||
<Route exact path='/' component={HomePage} /> | ||
<Route exact path='/public' component={PublicPage} /> | ||
<Route exact path='/private' component={PrivatePage} /> | ||
</Switch> | ||
</BrowserRouter> | ||
); | ||
} | ||
}; | ||
|
||
export default App; |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import './index.css'; | ||
import App from './App'; | ||
import * as serviceWorker from './serviceWorker'; | ||
|
||
ReactDOM.render(<App />, document.getElementById('root')); | ||
|
||
// If you want your app to work offline and load faster, you can change | ||
// unregister() to register() below. Note this comes with some pitfalls. | ||
// Learn more about service workers: https://bit.ly/CRA-PWA | ||
serviceWorker.unregister(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.