react-isolator
TypeScript icon, indicating that this package has built-in type declarations

0.1.10 • Public • Published

React Component Isolator · GitHub license npm version

As the name indicates, this is a tool that allows you to visualized React components in an isolated environment.

Library running screenshot

Quick start

using npm:

npm install -D react-isolator

using yarn:

yarn add --dev react-isolator

Once the package is installed, you can import the library using import or require approach:

import { ReactIsolator, IsolatedItem } from "react-isolator";

Example

import { ReactIsolator, IsolatedItem } from "react-isolator";

function Button({ label = "" }) {
  return (
    <button type="button" onClick={() => console.log("Button clicked!")}>
      <p>{label}</p>
    </button>
  );
}

export function IsolatedButton() {
  return <Button label="I am a Button!" />;
}

export default Button;

<ReactIsolator>
  <IsolatedItem name="Button" element={<Button />} />
</ReactIsolator>;

Alternatively, the isolated code can be located in its own file:

button.isolated.jsx
import Button from ../components/Button;

function IsolatedButton() {
  return <Button label='I am a Button!' />
}

export default IsolatedButton;

Components


ReactIsolator

Main component of the tool, can be conceptualized as a list to visualize every child component.


IsolatedItem

Component that holds the isolated element to visualize.

Props

  • name: Label to identify the component in visualizer.
  • jsxElement: The component to render.

License

React component library is supported under MIT licensed.

Package Sidebar

Install

npm i react-isolator

Weekly Downloads

2

Version

0.1.10

License

MIT

Unpacked Size

710 kB

Total Files

42

Last publish

Collaborators

  • maxkalavera