New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hrx

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hrx

Single page app framework

  • 0.3.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

hrx

CircleCI

Overview

Framework for React and Formula.

why hrx?

  • h is for hyperscript.
  • r is for RUN expression.
  • x is for xander.

hrx is hyperscript + formula + xander

Usage

Installation

npm install --save hrx formula

Examples

Quick start

A minimal hrx app with home and 404 page.

// Import the boot function to intialize hrx.
import { render } from "hrx";

// Define routes for your app.
let routes = [
  {
    path: "/",
    component: props => "Hello, World."
  },
  {
    path: "*",
    component: props => "No Page Found"
  }
];

// Boot the app into a root DOM element. Map your URLs to component to render.
render({ routes }, document.getElementById("root"));

With React's render

Render HRX with React's render function.

// Import the boot function to intialize hrx.
import { app } from "hrx";
import React from "react";
import { render } from "react-dom";

// Define routes for your app.
let routes = [# hrx

[![CircleCI](https://circleci.com/gh/FormBucket/hrx.svg?style=svg)](https://circleci.com/gh/FormBucket/hrx)

## Overview

Framework for [React](https://github.com/facebook/react) and [Formula](https://github.com/FormBucket/formula).

## why hrx?

* **h** is for hyperscript.
* **r** is for `RUN` expression.
* **x** is for [xander](https://github.com/FormBucket/xander).

hrx is **h**yperscript + **f**ormula + **x**ander

## Usage

## Installation

```sh
npm install --save hrx formula

Examples

Quick start

A minimal hrx app with home and 404 page.

// Import the boot function to intialize hrx.
import { render } from "hrx";

// Define routes for your app.
let routes = [
  {
    path: "/",
    component: props => "Hello, World."
  },
  {
    path: "*",
    component: props => "No Page Found"
  }
];

// Boot the app into a root DOM element. Map your URLs to component to render.
render({ routes }, document.getElementById("root"));

With React's render

Render HRX with React's render function.

// Import the boot function to intialize hrx.
import { app } from "hrx";
import React from "react";
import { render } from "react-dom";

// Define routes for your app.
let routes = [
  {
    path: "/",
    component: props => "Hello, World."
  },
  {
    path: "*",
    component: props => "No Page Found"
  }
];

let App = app({ routes });

// Boot the app into a root DOM element. Map your URLs to component to render.
render(<App />, document.getElementById("root"));

Components

A link component to hyperlink your app without annoying page refreshes.

import {Link} from 'hrx'
<Link to="/buckets" />
<Link type="button" to="/buckets" />
<Link type="button" to="/buckets" type="button" /> // render button tag instead of a
Eval Component

The Eval component calculates the result of a formula expression.

import {Eval} from 'hrx'
<Eval exp="SUM(A, B)" values={ A: 2, B: 2 } />
Rule Component

The Rule component renders HTML describing a formula expression.

import {Rule} from 'hrx'
<Rule exp="SUM(A, B)" />
Container Component

The Container component renders a child component based on URL.

import { Link } from "hrx";
render(<Container />);
Connect Component

The Connect HOC component syncs Xander state with React state.

import { connect, Container } from "hrx";
render(
  connect(Container) // <- boot function does just this
);
Loadable / loader HOCs

The Loadable HOC works with webpack to split your app into chunks that load dynamically.

import { loadable, loader } from "hrx";
let routes = [
  {
    path: "/",
    component: loadable({
      loader: () => import("./home"),
      delay: 500 // 0.500 seconds
    })
  },
  {
    path: "*",
    component: loader(() => import("./404"))
  }
];

Stores

Router

A minimal router, backed by native history API.

import { router } from "hrx";
router.open("/buckets/1");

Use redirect to modify URL without adding an entry to the history state.

router.redirect("/buckets");
Load Routes

Load routes and related configuration without boot.

import { router } from "hrx";
router.loadRoutes([
  {
    path: "/",
    component: require("./pages/home")
  }
]);
Window Store

The window store (optional) keeps track of window size and scroll location; keeps in sync with DOM.

import { loadWindowStore } from "hrx";

loadWindowStore();
Custom State management

Use createStore to manage locally cached data.

import { createStore } from "hrx";# hrx

[![CircleCI](https://circleci.com/gh/FormBucket/hrx.svg?style=svg)](https://circleci.com/gh/FormBucket/hrx)

## Overview

Framework for [React](https://github.com/facebook/react) and [Formula](https://github.com/FormBucket/formula).

## why hrx?

* **h** is for hyperscript.
* **r** is for `RUN` expression.
* **x** is for [xander](https://github.com/FormBucket/xander).

hrx is **h**yperscript + **f**ormula + **x**ander

## Usage

## Installation

```sh
npm install --save hrx formula

Examples

Quick start

A minimal hrx app with home and 404 page.

// Import the boot function to intialize hrx.
import { render } from "hrx";

// Define routes for your app.
let routes = [
  {
    path: "/",
    component: props => "Hello, World."
  },
  {
    path: "*",
    component: props => "No Page Found"
  }
];

// Boot the app into a root DOM element. Map your URLs to component to render.
render({ routes }, document.getElementById("root"));

With React's render

Render HRX with React's render function.

// Import the boot function to intialize hrx.
import { app } from "hrx";
import React from "react";
import { render } from "react-dom";

// Define routes for your app.
let routes = [
  {
    path: "/",
    component: props => "Hello, World."
  },
  {
    path: "*",
    component: props => "No Page Found"
  }
];

let App = app({ routes });

// Boot the app into a root DOM element. Map your URLs to component to render.
render(<App />, document.getElementById("root"));

Components

A link component to hyperlink your app without annoying page refreshes.

import {Link} from 'hrx'
<Link to="/buckets" />
<Link type="button" to="/buckets" />
<Link type="button" to="/buckets" type="button" /> // render button tag instead of a
Eval Component

The Eval component calculates the result of a formula expression.

import {Eval} from 'hrx'
<Eval exp="SUM(A, B)" values={ A: 2, B: 2 } />
Rule Component

The Rule component renders HTML describing a formula expression.

import {Rule} from 'hrx'
<Rule exp="SUM(A, B)" />
Container Component

The Container component renders a child component based on URL.

import { Link } from "hrx";
render(<Container />);
Connect Component

The Connect HOC component syncs Xander state with React state.

import { connect, Container } from "hrx";
render(
  connect(Container) // <- boot function does just this
);
Loadable / loader HOCs

The Loadable HOC works with webpack to split your app into chunks that load dynamically.

import { loadable, loader } from "hrx";
let routes = [
  {
    path: "/",
    component: loadable({
      loader: () => import("./home"),
      delay: 500 // 0.500 seconds
    })
  },
  {
    path: "*",
    component: loader(() => import("./404"))
  }
];

Stores

Router

A minimal router, backed by native history API.

import { router } from "hrx";
router.open("/buckets/1");

Use redirect to modify URL without adding an entry to the history state.

router.redirect("/buckets");
Load Routes

Load routes and related configuration without boot.

import { router } from "hrx";
router.loadRoutes([
  {
    path: "/",
    component: require("./pages/home")
  }
]);
Window Store

The window store (optional) keeps track of window size and scroll location; keeps in sync with DOM.

import { loadWindowStore } from "hrx";

loadWindowStore();
Custom State management

Use createStore to manage locally cached data.

import { createStore } from "hrx";
createStore(name, reducerOrSpec, actionsAndQueries);

For more info checkout xander.

Keywords

FAQs

Package last updated on 18 May 2018

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