Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@geops/create-react-web-component

Package Overview
Dependencies
Maintainers
8
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@geops/create-react-web-component

Create a web-component from a React component.

  • 3.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
8
Created
Source

Create React Web Component

NPM Version Github License Build Status

This project is a fork of the archived but great SimonHoiberg/create-react-web-component.

It includes the React 18 support and removed all cli and styled stuff.

How to use it

In your project:

yarn add @geops/create-react-web-component

Creates the web-component using your React component:

import ReactWebComponent from "@geops/create-react-web-component";
import MyReactComponent from "./MyReactComponent";

const attributes = {
  string: "default value",
}

const properties = {
  object: { "key": "value"}
  array: ["foo"]
}

ReactWebComponent.setAttributes(attributes);
ReactWebComponent.setProperties(properties);
ReactWebComponent.render(MyReactComponent, "my-web-component", { shadow: false });

Then load your module in a HTML page

<html>
  <head>
    <script type="text/javascript" src="your module bundle file"> </script>
  </head>
  <body>
    <my-web-component id="myWebComponent" string="foo"></my-web-component>
    <script>
      const elt = doucment.getElementById('myWebComponent');

      console.log(elt.string); // --> "foo"
      console.log(elt.object); // --> "{ "key": "value" }"
      console.log(elt.array); // --> "['foo']"
    </script>
  </body>
</html>

Contributing

Getting Started

yarn install
yarn test

Issuess

In the case of a bug report, bugfix or a suggestions, please feel very free to open an issue.

Pull request

Pull requests are always welcome, and I'll do my best to do reviews as fast as I can.

License

This project is licensed under the MIT License

Get Help

Read more about using Web Components with React on the official React Docs

  • If appropriate, open an issue on GitHub

Keywords

FAQs

Package last updated on 19 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc