Skip to content

reference project for creating react reusable components with rollup

License

Notifications You must be signed in to change notification settings

rrmerugu-archive/hello-react-components

Repository files navigation

React Setup Example

This is a reference project for creating react reusable components with rollup.

To use with in a HTML page

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>UMD Example</title>
    <script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
    <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
    <script src="./dist/umd/bundle.js"></script>
    <link rel="stylesheet" href="./dist/umd/bundle.css">

</head>
<body>
<div id="root"></div>

<script type="text/javascript">
    const e = React.createElement;
    const domContainer = document.querySelector('#root');
    const root = ReactDOM.createRoot(domContainer);
    root.render(e(HelloApp.ArtBoard, {label: "R2Lab"}));
</script>

</body>
</html>

example in examples/html-umd/index.html

To use with in a ReactJS App

import {ArtBoard} from "hello-app"

function App() {
    return (
        <ArtBoard label={"R2Lab"}/>
    );
}

export default App;

Full example in examples/react-app

About

reference project for creating react reusable components with rollup

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published