DEV Community

SnowBit
SnowBit

Posted on

How to use Props in React

Basically, Props are arguments passed into React components. They are just like a functional arguments in JavaScript and attributes in HTML.

Word Props means the properties of a component

  • A component Text with attribute text
<Text text="World!"/>
Enter fullscreen mode Exit fullscreen mode
  • Text Component
function Text(props){
  return(
    <h1>Good, {props.text}</h1>
  )
}
Enter fullscreen mode Exit fullscreen mode

Discussion (0)