I\'m trying to create an input form that stores information in a component\'s state variable, then outputs that variable on the screen. I read the docs on controlled compone
Prevent the default behaviour:
afterSubmission(event) { event.preventDefault(); let name = this.state.itemName; this.setState ({ storedItemName:this.state.itemName }, function() { alert(this.state.storedItemName); // Shows the right value! }); }