import React from 'react';
const person = (props) => {
return (
I am a {props.name}, and I am {props.age} years old
{props.children}
)
}
export default person
We can see that we are using ''props.name'', ''props.age'', and ''props.children''. When the value is updated, they UI will also be updated.
Here is how we use this child component.
.
.
.
import Person from './Person/Person';
.
.
.
class App extends Component {
render() {
return (
Testing
This is a demo
)
}
}
export default App;
we can see that we have name, and age properties inside the Person opening tag. The children part is what between the Person open and close tags. For passing values or variables inside the opening tag. we use ''{}'' and put the value/var inside.