ReactDOM.render() with the <Welcome name="Sara" /> element.Welcome component with {name: 'Sara'} as the props.Welcome component returns a <h1>Hello, Sara</h1> element as the result.<h1>Hello, Sara</h1>.Note: Always start component names with a capital letter.React treats components starting with lowercase letters as DOM tags. For example,<div />represents an HTML div tag, but<Welcome />represents a component and requiresWelcometo be in scope.
App component that renders Welcome many times:App component at the very top. However, if you integrate React into an existing app, you might start bottom-up with a small component like Button and gradually work your way to the top of the view hierarchy.Comment component:author (an object), text (a string), and date (a date) as props, and describes a comment on a social media website.Avatar:Avatar doesn’t need to know that it is being rendered inside a Comment. This is why we have given its prop a more generic name: user rather than author.Comment a tiny bit:UserInfo component that renders an Avatar next to the user’s name:Comment even further:Button, Panel, Avatar), or is complex enough on its own (App, FeedStory, Comment), it is a good candidate to be extracted to a separate component.sum function: