javascript / beginner
Snippet
Accessing Basic Component Props
In React, 'props' is an object that contains all the data passed from a parent component to a child component.
snippet.js
1
2
3
function WelcomeCard(props) {return <div>Welcome, {props.username}</div>;}
react
Breakdown
1
function WelcomeCard(props)
The function receives one argument, usually named 'props', representing the input data.
2
{props.username}
The curly braces inject the value of the 'username' property into the UI.