Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

231
Visualizações
How to pass props throught React components without using Redux

Sup guys! Can I have some help to understood this assessment challenge? I've allready send it, but a horrible doubt keep bouncing on my head:

I was ordered to complete a simple React app, that loads user input in a component, and pass those data as props to another component, rendered from another one. Something like this:

function DataInput(){

const [input, setInput]=useState({
firstName:'',
lastName:'',
phone:'',
)}

function handleChange(e){
setInput({
...input,
[e.target.name]:e.targe.value;
)}
}

function handleSubmit(){
/* dunno if this function is usefull to something. Can't figure out how to pass props from
   a child ( DataInput ) to another one ( ContactList)without using Redux to store a Global State.
*/
}

return(
<form>
<input 
type="text"
name="firstName"
placeholder="First Name"
value={input.firstName}
onChange={handleChange}
/>

<input 
type="text"
name="lastName"
placeholder="Last Name"
value={input.lasttName}
onChange={handleChange}
/>

<input 
type="text"
name="phone"
placeholder="Phone Number"
value={input.phone}
onChange={handleChange}
/>
<button onClick={handleSubmit}>Add User</button>
</form>

)}

function ContactList(props){
return(
<div>
<label>{props.firstName}</label>
<label>{props.lastName}</label>
<label>{props.phone}</label>    
</div>
)}

function App(){
render(){
<IngresoDatos />
<ContactList />
}
}

ReactDOM.render(<App/>, document.getElementById('root'))



about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda