React newbie back here with another question (lol). I have a function that returns a generic component and I was wondering if it's possible to get the state value from that component? Here is what I'm trying to do:
EDIT: I've updated some of my code according to responses
class CreateTable extends Component {
constructor(props) {
super(props_;
this.state = { elements: [] };
}
handleCreateTable() {
var elements = this.state.elements; // []
elements.push(<TextInput key={"TableName"} label="Table Name" />)'
elements.push(
<DataTable
tableName = { elements[0].value } // <--- I'd like to do something like this
/>
);
this.setState({ elements: elements })
}
}
TextInput has a child TextField
Thank you for your help!