Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class App extends React.Component {
- // You need to define the state in the constructor
- constructor(props) {
- super(props);
- this.state = {
- username: '', // why would Username and Password be booleans?
- password: ''
- }
- this.closeLogin = this.closeLogin.bind(this);
- this.handleChange = this.handleChange.bind(this);
- this.login = this.login.bind(this); // you don't "do" logins, you "login"
- }
- closeLogin() {
- props.openLogin(false);
- }
- handleChange(event, property) {
- this.setState({
- [prop]: event.target.value
- })
- }
- login() {
- console.log(props.appId + ' : ' + this.state.username);
- }
- render() {
- return (
- <Dialog
- open={true}
- onClose={this.closeLogin}
- ariaLabelledBy='form-dialog-title'
- >
- <DialogContent>
- <TextField
- fullWidth
- require
- name="username"
- onChange={()=>{this.handleChange('Username')}}
- value={this.state.username}
- />
- <Button onClick={()=>{this.doLogin(appId)}} className={classes.button}>Log Me In</Button>
- </DialogContent>
- </Dialog>
- );
- }
- }
Add Comment
Please, Sign In to add comment