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

babel-plugin-realar

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-realar

Automatic observe jsx arrow functions for Realar

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-realar

npm version code coverage

Automatic observe jsx arrow functions for Realar for smartify and purify your code :+1:

That plugin for babel wraps all not wrapped arrow functions (that contains JSX) to Realar observe function. Less code more effectivity!

import React from 'react';
import { box, shared, /* observe */ } from 'realar';

class Ticker {
  @box value = 0;
  next = () => this.value += 1;
}

const sharedTicker = () => shared(Ticker);

// const App = observe(() => {
const App = () => {
  const { value, next } = sharedTicker();
  return (
    <>
      Ticker: {value}
      <br />
      <button onClick={next}>Next</button>
    </>
  );
};

See wrapped version of it on CodeSandbox.

You are no need more to wrap (decorate) JSX components to observe function! It will be automatic.

Installation

npm install --save-dev babel-plugin-realar
# or
yarn add babel-plugin-realar

And update your babel config:

// .babelrc
{
  "plugins": [
    "realar"
  ]
}

Enjoy and happy coding!

Keywords

FAQs

Package last updated on 21 Dec 2020

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