=
import React from 'react';
import ReactDOM from 'react-dom/client';
import Car from './Car'; // Import the Car component
const container = document.getElementById('root');
const root = ReactDOM.createRoot(container);
root.render(<Car />); // Render the Car component
=
// car.js
import React from 'react';
class Car extends React.Component {
constructor() {
super();
this.state = { color: "red" };
}
render() {
return <h2>I am a Car!</h2>;
}
}
export default Car;
=
No comments:
Post a Comment