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

@lit-labs/react

Package Overview
Dependencies
Maintainers
11
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lit-labs/react

A React component wrapper for web components.

  • 2.1.1-pre.0
  • pre
  • Source
  • npm
  • Socket score

Version published
Maintainers
11
Created

What is @lit-labs/react?

@lit-labs/react is an npm package that provides utilities for integrating Lit components with React. It allows developers to use Lit-based web components seamlessly within React applications.

What are @lit-labs/react's main functionalities?

Creating React Components from Lit Elements

This feature allows you to create React components from Lit elements. The `createComponent` function takes React, the tag name of the custom element, and the Lit element class, and returns a React component that can be used in your React application.

import { createComponent } from '@lit-labs/react';
import * as React from 'react';
import { MyElement } from 'my-element';

const MyReactComponent = createComponent(React, 'my-element', MyElement);

export default MyReactComponent;

Passing Properties and Events

This feature allows you to pass properties and events from React to Lit elements. The fourth argument to `createComponent` is an object that maps React props to Lit element properties and events.

import { createComponent } from '@lit-labs/react';
import * as React from 'react';
import { MyElement } from 'my-element';

const MyReactComponent = createComponent(React, 'my-element', MyElement, {
  onClick: 'click',
  onCustomEvent: 'custom-event'
});

export default MyReactComponent;

Other packages similar to @lit-labs/react

FAQs

Package last updated on 29 Sep 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