Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Passing Boolean values as Props in react

const Banner = props => {
  const name = props.name
  return <div>{props.show && <p>Hello {name}</p>}</div>
}

function App() {
  return (
    <div>
      <Banner name="Ranjeet" show/>
    </div>
  )
}

export default App
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Passing #Boolean #values #Props #react
ADD COMMENT
Topic
Name
3+5 =