Last active
November 9, 2018 12:05
-
-
Save thiagoferreiraw/5cc73ce8dead3228d0cf9139e7042f76 to your computer and use it in GitHub Desktop.
React Tests - Medium
This file contains hidden or 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, { Component } from 'react'; | |
import PropTypes from "prop-types" | |
import Home from "./Home" | |
const fakeDatabase = { | |
"Heisenberg": [ | |
"8am - Chemistry classes at school", | |
"12:30pm - Meet Jesse for lunch", | |
"15pm - Meet Gus at the Pollos Hermanos", | |
"20pm - Dinner by the pool with Hank and Marie" | |
], | |
"GusFring": [ | |
"8am - Meeting with the DEA", | |
"15pm - Meet Walter at the Pollos Hermanos", | |
] | |
} | |
class App extends Component { | |
static propTypes = { | |
isLoggedIn: PropTypes.bool, | |
username: PropTypes.string | |
} | |
render() { | |
const { isLoggedIn, username } = this.props | |
return ( | |
<div className="App"> | |
{ | |
isLoggedIn | |
? <Home username={username} tasks={fakeDatabase[username]} /> | |
: <p>Hello, visitor. Sign in to continue.</p> | |
} | |
</div> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment