Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Pass Props to a Component Using Short circuit evaluation in react

const Banner = props => {
  const name = props.name || "user"
  return <div>Hello {name}</div>
}

function App() {
  return (
    <div>
      <Banner />
    </div>
  )
}

export default App
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Pass #Props #Component #Using #Short #circuit #evaluation #react
ADD COMMENT
Topic
Name
3+1 =