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

react-area

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-area

_NOTE_: For now, this is an experimental Proof of Concept.

  • 0.1.1-alpha.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
248
decreased by-8.49%
Maintainers
1
Weekly downloads
 
Created
Source

React Area

NOTE: For now, this is an experimental Proof of Concept.

Install

npm install react-area

Getting Started

First, wrap your app in the <AreaProvider /> component:

import { AreaProvider } from 'react-area';
import ReactDOM from 'react-dom';
import React from 'react';

ReactDOM.render(
  <AreaProvider>
    <YourApp />
  </AreaProvider>,
  document.getElementById('root'),
);

Next, anywhere in your app you can define an "render area" with a <RenderArea /> component:

import { RenderArea } from 'react-area';
import React from 'react';

function Layout() {
  return (
    <div>
      <aside>
        <RenderArea name="navigation" />
      </aside>
      <main>
        <RenderArea name="main" />
      </main>
    </div>
  );
}

And then, from any other component you can render inside those areas by using the <Content /> component:

import { Content } from 'react-area';
import React from 'react';

function SomeFeature() {
  return (
    <>
      <Content name="navigation">
        <a href="/some-feature">SomeFeature</a>
      </Content>

      <Content name="main">
        <div>Feature Content</div>
      </Content>
    </>
  );
}

Prior Art

This project is heavily inspired by these projects:

  • Slot Fill by Cam West: https://github.com/camwest/react-slot-fill
  • SlotFill by wordpress: https://github.com/WordPress/gutenberg/tree/master/packages/components/src/slot-fill

Keywords

FAQs

Package last updated on 13 May 2022

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