Good day, i have a question. What alternatives you can do with data from React.
If you have:
What you think? Good idea is implementing backend + database or send this data to store?
class Mail extends React.Component{
constructor(props){
super(props);
this.state={value:''};
this.handleChange = this.handleChange.bind(this);
this.handleSubmit= this.handleSubmit.bind(this);
}
handleChange(event){
this.setState({value:event.target.value});
}
handleSubmit(event){
console.log('submited');
}
render(){
return(
<form onSubmit ={this.handleSubmit}
className ="mail_ebook">
<div className="group mail_left">
<input className ="text" type="text"
value={this.state.value}
onChange={this.handleChange}
required/>
<span className="highlight"></span>
<span className="bar"></span>
<label>write your mail now</label>
</div>
<input className ="hero_button margin_left" type="submit" value="Read it" />
</form>
)
}
};
Per OP request (see comments) I will recommend using ReduxJS. With Redux the core concept to understand is Reducers, pure functions which will have a default state and can be dispatched actions with dispatch(action). Upon elaborating an action, they will update the state. You can define your set of actions (for example one to add an input variable, one to delete the last added or by name.. just examples) and the state will change according to each action. The reducer will then return the current state, a Javascript object. You can retrieve the state with getState() as well.
Please read https://redux.js.org/api-reference/store#getState
If your question also includes wanting to save this data to a database you will have to use some API to connect to it, or perhaps fs to save to files.