Should be simple, but for some reason, I cannot figure out this one. I just want a value defined in the Parent to be usable by the Child, but delivering the variable does not seem to work.
function Parent(props) {
const name='Jimmy';
props.foo = name;
return props.children;
}
function Child(props) {
const result = props.foo;
return <h1>hello, {result}</h1>
}
export default function App() {
return (
<div className="App">
<Parent>
<Child foo={this.props} />
</Parent>
</div>
);
}