0

Could someone, please, tel me what is the : {name : "Taylor"} in the code below:

ReactDOM.render(React.createElement(HelloMessage, { name: "Taylor" }),
document.getElementById('hello-example'));
Peter B
  • 18,964
  • 5
  • 26
  • 60
  • `{ name: "Taylor" }` is an object that is passed to HelloMessage. I'm guessing the HelloMessage contains some code that says: `Hello ${name}`. So, the name get's replaced with Taylor and the output is 'Hello Taylor`. – Tom Bombadil Apr 04 '21 at 21:27

2 Answers2

2

It passes the object { name: "Taylor" } into the props object for the HelloMessage component.

As a result, inside the HelloMessage component, props.name will equal "Taylor".

For more info see here: https://reactjs.org/docs/react-without-jsx.html

Peter B
  • 18,964
  • 5
  • 26
  • 60
1

It is an object in JavaScript. Read about objects in JS:

https://www.w3schools.com/js/js_object_definition.asp

Sara Bean
  • 119
  • 7