Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created October 21, 2019 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/2f2746404329c7cb17235569844b376d to your computer and use it in GitHub Desktop.
Save codecademydev/2f2746404329c7cb17235569844b376d to your computer and use it in GitHub Desktop.
Codecademy export
import React from 'react';
import ReactDOM from 'react-dom';
class Contact extends React.Component {
constructor(props) {
super(props);
this.state = {
password: 'swordfish',
authorized: false
};
this.authorize = this.authorize.bind(this);
}
authorize(e) {
const password = e.target.querySelector(
'input[type="password"]').value;
const auth = password == this.state.password;
this.setState({
authorized: auth
});
}
render() {
return (
<div id="authorization">
<h1>Contact</h1>
<ul>
<li>
client@example.com
</li>
<li>
555.555.5555
</li>
</ul>
</div>
);
}
}
ReactDOM.render(
<Contact />,
document.getElementById('app')
);
@ThomasAurelius
Copy link

This is the code from the very start of the exercise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment