I am working on my React project. I have a question on how to capture entire form object when user submit all the inputs information. For example, in Node.js Mongoose, req.body
returns entire object.
How can I get the entire form submit object in react? Thanks.
This is my form code in React:
return (
<div>
<ol>
{listItems}
<div style={styles.input}>
<form>
<input onChange={this.updateUsername.bind(this)} id='image' className='form-control' type='text' placeholder='image'/><br />
<input onChange={this.updateUsername.bind(this)} className='form-control' type='text' placeholder='Username'/><br />
<input className='form-control' type='text' placeholder='Age'/><br />
<input className='form-control' type='text' placeholder='Gender'/><br />
<input className='form-control' type='text' placeholder='Activity'/><br />
<input className='form-control' type='text' placeholder='Location'/><br />
<input className='form-control' type='text' placeholder='ZipCode'/><br />
<button onClick={this.submitComment.bind(this)} className='btn btn-primary'>Submit Activity</button>
</form>
</div>
</ol>
</div>
)