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

realar

Package Overview
Dependencies
Maintainers
1
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

realar

Advanced state manager for React

  • 0.6.0-alpha.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

Realar

npm version npm bundle size code coverage typescript supported

The state manager to reduce developers' coding time and increase the lifetime of your codebase.

Realar targeted to all scale applications up to complex enterprise solutions on modular architecture.

  • Logic free React components. Perfect instruments for moving all component logic outside. Your React component will be clean from any unnecessary code, only view, only JSX, no more.
  • Lightweight and Fast. Less then 5kB. Aims at the smallest size of the resulting bundle. And only parts are updated in which is really necessary to make changes.
  • Value and Signal is the big elephants remind Store and Action from Redux. Allows you to perform familiar coding techniques, and also add many modern features.
  • Declarative and Imperative both supported.
  • Stream event and value programming.
  • Modular Architecture. Possibilities for the implementation of three levels of logic availability. Shared stateful is available for any part of your app. Scoped logic decomposition for React component context visibility. And React component local logic.
  • Decorators for classes lovers. Support OOP as one of the primary syntaxes. The implementation of transparent functional reactive programming (TFRP) with React (looks similar to Mobx). And the babel plugin for automatic wrap all arrow JSX functions for the best clean code.

Usage

You can make stores and "actions"

const store = value(0)

const add = store.updater((state, num) => state + num)
const inc = store.updater(state => state + 1)

And bind to React easily

const App = () => {
  const state = useValue(store)

  return <p>{state} <button onClick={inc}>+</button></p>
}

You can make streams

const addendum = value('0').pre(ev => ev.target.value)
const sum = signal()
  .map(() => +addendum.val)
  .filter()
  .to(add);

And bind to React

const App = () => {
  const addendumState = useValue(addendum)

  return <p>
    <input value={addendumState} onChange={addendum} />
    <button onClick={sum}>sum</button>
  </p>
}

You can use classes with decorators

class Counter {
  @prop state = 0;

  add = (num) => this.state += num;
  inc = () => this.add(1);
}

And bind to React

const App = observe(() => {
  const { state, inc } = useLocal(Counter)

  return <p>{state} <button onClick={inc}>+</button></p>
})

And you can use it together

class Positive {
  @cache get state() {
    return store.val > 0 ? 'positive' : 'non'
  }

  constructor() {
    sync(() => this.state, console.log)
  }
}

Documentation

Demos

In Production

Articles

Installation

npm install realar
# or
yarn add realar

Enjoy and happy coding!

Keywords

FAQs

Package last updated on 07 Jun 2021

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