Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Renaming props in react

const UserCard = ({ name, role: occupation }) => {
  return (
    <div>
      <p>Name: {name}</p>
      <p>Occupation: {occupation}</p>
    </div>
  )
}

function App() {
  return (
    <div>
      <UserCard name="Adil" role="Frontend Developer" />
    </div>
  )
}

export default App
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #Renaming #props #react
ADD COMMENT
Topic
Name
8+7 =