Intention: I want to use the data of a user filled reactstrap form after submission/click on finish button to be read/handled in a function/callback.
Tried solution: I created a finish/login/submit button with <Button color="primary" onClick={this.login}>Login</Button>
and now have the problem that I do not know how to access the data in the input fields. I guess I somehow have to use the names or ids but can't figure it out.
Question: How to get the user input data from an <Input>
field in login()
?
Code:
import React from 'react';
import {Button, Form, FormGroup, Label, Input, Container} from 'reactstrap';
class AWSLogin extends React.Component {
login() {
console.log(???); //< Should output the user input in the form field with id "aws_access_key_id"
};
render() {
return (
<Container>
<Form>
<FormGroup>
<Label for="aws_access_key_id">AWS Access Key ID</Label>
<Input type="string" name="aws_access_key_id" id="aws_access_key_id"
placeholder="AKIAIQBMB7KQWPNDFT7A"/>
</FormGroup>
<Button color="primary" onClick={this.login}>Login</Button>
</Form>
</Container>
);
}
}
export default AWSLogin;