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,379
  • 7
  • 23
  • 47

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
  • 32,666
  • 37
  • 119
  • 162