I am stuck. I have several seperate components on seperate files. If I render them in main.jsx like following:
ReactDOM.render( , doc
Here Car component is inside the another component i.e Garage components. When Garage component in rendering Car component is also renders. Same concept as like one function inside another function.
class Car extends React.Component {
render() {
return I am a Car!
;
}
}
class Garage extends React.Component {
render() {
return (
Who lives in my Garage?
);
}
}
ReactDOM.render( , document.getElementById('root'));