1
Hello
I’m studying the Reactjs... and made the following structure:
[code]
class MyNascimento extends Component {
constructor(props) {
super(props);
this.state = {
nascimentoValue: null,
};
}
render() {
return (
<div className="telaNascimento">
<span className="p-float-label">
<InputMask
id="nascimento"
size={20}
className={css.txtcampos}
mask="99/99/9999"
slotChar="__/__/____"
value={this.state.nascimentoValue}
onChange={event => {
this.setState({
nascimentoValue: event.target.value
});
}}
/>
<label htmlFor="nascimento">Nascimento</label>
</span>
{/* Fim telaNascimento */}
</div>
);
}
}
class RegistroClientes extends Component {
constructor(props) {
super(props);
this.state = {
nascimentoValue: null
};
}
render() {
return (
<div className={css.fundo}>
<MyNascimento
valueNascimento={this.state.nascimentoValue}
handleClick={this.clickProximo}
/>
{/* FIM DA DIV FUNDO PRINCIPAL */}
</div>
);
}
}
export default RegistroClientes;
[/code]
How do I pick up what was typed in the Mynascimento component and play in the birth variable that is in Registroclientes?
Solution was based on this topic: https://answall.com/questions/339852/pega-state-componente-filho-no-react
– Alex Passos
Welcome to [en.so]! Don’t add "Solved" to the title. I know it’s common practice in many forums, but here it works different. If you have found the solution, just use the answer field below and you yourself puts the solution found. Don’t forget to put in the detailed steps you did (see [Answer]), because the idea is that the answer is useful for anyone who has the same problem and visit the site in the future. Then it’s up to you accept the answer, and she’ll be "settled" :-)
– hkotsubo