Answer the question
In order to leave comments, you need to log in
Why is there such a scheme in React?
Code from the React documentation:
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
function App() {
return (
<div>
<Welcome name="Sara" />
<Welcome name="Cahal" />
<Welcome name="Edite" />
</div>
);
}
ReactDOM.render(
<App />,
document.getElementById('root')
);
<App />
<Welcome/>
return <h1>Hello, {props.name}</h1>;
<App />
Answer the question
In order to leave comments, you need to log in
Renders what is returned from the App() functional component.
App() renders a div inside which renders 3 times what the Welcome() component will return, which in turn returns a welcome title.
Here is the order. What is the problem?
If we render the Welcome tag through ReactDOM, we will get one title with a greeting instead of three
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question