Socket
Socket
Sign inDemoInstall

react-teleporter

Package Overview
Dependencies
5
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.2 to 3.1.0

3

dist/index.d.ts

@@ -13,2 +13,3 @@ import * as React from 'react';

};
declare type ChildrenFunction = (target: Element) => React.ReactNode;
interface CreateTeleporterOptions {

@@ -22,3 +23,3 @@ multiSources?: Boolean;

Source: React.FC<{
children: React.ReactNode;
children: React.ReactNode | ChildrenFunction;
}>;

@@ -25,0 +26,0 @@ Target: ComponentWithAs<{}, "div">;

{
"name": "react-teleporter",
"description": "Teleport React components in the same React tree.",
"version": "3.0.2",
"version": "3.1.0",
"sideEffects": false,

@@ -6,0 +6,0 @@ "type": "module",

@@ -112,2 +112,17 @@ # react-teleporter

### Use function as children
Useful for having access to the `Target` element. E.g., to dispatch an event through the `Target` when something happens in the `Source`.
```js
const Teleporter = createTeleporter();
const forwardEvent = (element) => (event) =>
element.dispatch(new Event(event.type, event));
<Teleporter.Source>
{(element) => <div onClick={forwardEvent(element)}></div>}
</Teleporter.Source>;
```
## API

@@ -114,0 +129,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc