I'm looking for a way that the declared function is called in the component several times (passing props to it), I'm doing it in app.js
but it only shows the h1
. Where should I start the function so that the component takes the values? inside of her?
function welcome(props) {
return <h1>Hola, {props.name}</h1>
}
export function App() {
return(
<div>
<h1>Hello 4to Componente</h1>
<welcome name="Ricardo" />
<welcome name="Paul" />
</div>
);
}
It's already rendering through index.js
with
ReactDOM.render(<App />, document.getElementById('four'));
I'll help you a bit with your problem, for that first let's read the reactjs documentation , and it says something like this:
Which translates to the following:
What does that mean? that you need to change the way you name your component, try this:
Any questions comment, I will gladly help you
In order for your function
welcome
to be considered a component, it must begin with a capital letter, as shown below: