Answer the question
In order to leave comments, you need to log in
Error props is not defined?
class Parent extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
{props.title}
</div>
);
}
}
class Children extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<Parent title="13"/>
);
}
}
ReactDOM.render(
<Children />,
document.querySelector('#root')
);
Answer the question
In order to leave comments, you need to log in
Props go to the arguments to the constructor and the render function (still in hooks, but not about that now). In your case, you can define the props argument for the render method, but it's better to just writethis.props
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question