This project showcases how to use React 19 and a custom web component together.
-
Clone the repository:
git clone https://github.com/yourusername/react-v19-ts-custom-element.git cd react-v19-ts-custom-element -
Install dependencies:
npm install
-
Start the development server:
npm start
-
Open your browser and navigate to
http://localhost:3000to see the app in action.
src/: Contains the source code of the React application.public/: Contains the public assets and the HTML template.
The Foobar web component is a custom element that can be used in your React components. It is defined in the src/Foobar.ts file.
To use the Foobar web component in your React component, you can import and register it as follows:
import './Foobar';
// ...existing code...
const App = () => {
return (
<div>
<h1>Welcome to React 19 with Custom Web Component</h1>
<foobar-element></foobar-element>
</div>
);
};
export default App;Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License.