Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

200
Views
Props.email value not printed on screen in react.js

See app.js and ternaryi.js I pass the email value in ternaryi and want to print on screen but only the count will be printed can anyone hep me to solve this problem.

App.js

import logo from "./logo.svg";
import "./App.css";
import React, { useState } from "react";
import Ternaryi from "./Ternaryi";

function App() {
  const [count, setCount] = useState(null);
  return (
    <div className="App">
      <form onSubmit={getFormData}>
        <select onChange={(e) => setCount(e.target.value)}>
          <option>select option</option>
          <option>1</option>
          <option>2</option>
          <option>3</option>
        </select>
        <button type="submit">submit</button>
      </form>
      <Ternaryi name={count}/>
    </div>
  );
  function getFormData(e) {
    console.log(count);
    <Ternaryi email={"hyy"}/>
    e.preventDefault();
  }
}

export default App;

Ternary.js

import {useState} from 'react';
function Ternaryi(props) {
    return (
      <div>
        <h1>email = {props.email}</h1>
        {props.name==1? <h1>Welcome user 1</h1>:props.name==2? <h1>Welcome user 2</h1>:<h1>Welcome user 3</h1>}
      </div>
    )
  }
  
  export default Ternaryi;
  

react image

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You should set the email attribute in the JSX element:

function App() {
  const [count, setCount] = useState(null);
  
  function getFormData(e) {
    e.preventDefault();
    console.log(count);
  }

  return (
    <div className='App'>
      <form onSubmit={getFormData}>
        <select onChange={(e) => setCount(e.target.value)}>
          <option>select option</option>
          <option>1</option>
          <option>2</option>
          <option>3</option>
        </select>
        <button type='submit'>submit</button>
      </form>
      <Ternaryi email='hyy' name={count} />
    </div>
  );
}

export default App;
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!