Reputation: 377
I set up two objects to mock some data. I would like to print the two elements on the page, but codePen doesn't show up any error as to why it wouldn't output to the page.
App should output two h1 elements that corresponds to the object I've assigned for. Don't think i need to initalize any states there. Just using the props from obj and obj2
thank you.
<div id="root">
</div>
let obj = {
firstName: "Bobby",
lastName: "Lee",
};
let obj2 = {
firstName: "Priscilla",
lastName: "Young",
};
function Element(props) {
return (
<h1> Welcome back {props.identification.firstName} {props.identification.lastName} !</h1>;
);
}
function App() {
return (
<div>
<Element identification={obj} />
<Element identification={obj2} />
</div>
);
}
ReactDOM.render(<App />, document.getElementById('root'));
Upvotes: 0
Views: 45
Reputation: 1341
Try this
function Element(props) {
return (
<h1> Welcome back {props.identification.firstName} {props.identification.lastName} !</h1>
);
}
Upvotes: 3