1

I am learning React-JSX and I have tried a code

function sayHello(){
  return <h1>Haiiiiii</h1>
}
class App extends Component {
  render() {
    return (
      <div>
      <sayHello> Haiiiiii </sayHello>
      </div>
    );
  }
}

Haiiiiii is rendering to screen but the <h1> heading format is not showing on screen.(ie.,Haiiiiii is not showing in bold font )

Jane Fred
  • 1,079
  • 5
  • 19
  • 40

1 Answers1

0

This is one way of doing

function sayHello(props){
  return <b>{props.text}</b>
}
class App extends Component {
  render() {
    return (
      <div>
      <sayHello text="Haiiiiiiii" />
      </div>
    );
  }
}
Hemadri Dasari
  • 29,321
  • 31
  • 106
  • 146