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

@azmenak/react-beam

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azmenak/react-beam

Beam react children to other parts of the React subtree

  • 1.1.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

React Beam

Allows children to other parts of the React subtree, and updates when needed. Originally designed for use with React Router in an app which has a common element such as a header with a title, where a component in the page subtree might want to change the title.

Install

npm i @azmenak/react-beam

Api

Receiver

import { Receiver } from 'react-beam';
Props
  • link:<String>: a unique ID, used to send children to the correct component
  • onUpdate:<Function (children)> (optional): runs whenever an update is received, with children as the only argument
  • children:<ReactNode> (optional): renders child node(s) when the recevied children are null or undefined
  • style:<Object> (optional): style will be shallowly mixed in when there is 1 child node, or is applied to a new <span> root node
  • className:<String> (optional): applied to child node when there is 1 child node, or applied to new <span> root node

Transmitter

Always renders null.

import { Transmitter } from 'react-beam';
Props
  • link:<String> a unique ID, used to send children to the correct component
  • children:<ReactNode> children to render in the <Receiver /> component

Usage

// AppHeader.jsx

import React from 'react';
import { Receiver } from 'react-beam';

export class AppHeader extends React.Component {
  render() {
    return (
      <div>
        { // ...other stuff }
        <Recevier link="header" />
      </div>
    );
  }
}
// SomePage.jsx

import React from 'react';
import { Transmitter } from 'react-beam';

export class SomePage extends React.Component {
  render() {
    return (
      <div>
        { // ...page stuff }
        <Transmitter link="header">
          <span>Page dependent content</span>
          <span>More content</span>
        </Transmitter>
      </div>
    );
  }
}

Keywords

FAQs

Package last updated on 15 Nov 2016

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