A data-driven, functional, and reactive framework for building Modern Web Apps in JavaScript.

Overview

Pure-frame

A data-driven, functional, and reactive framework for building Modern Web Apps in JavaScript. It leverages React, inspired by re-frame.

Install

npm

npm i pure-frame

yarn

yarn add pure-frame

Example with create-react-app

Step 0: setup

mkdir -p example/{src,public}
cd example

yarn init -y
yarn add pure-frame
yarn add --dev react-scripts

Step 1: create public/index.html

Hello pure-frame
">
>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta name="renderer" content="webkit" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>Hello pure-frametitle>
  head>
  <body>
    <noscript>please enable javascript to continue using this application.noscript>
    <div id="app">div>
  body>
html>

Step 2: create src/index.jsx

import React from 'react';
import ReactDOM from 'react-dom';

import {
    PureFrameRoot,
    defineExtractor,
    defineStateEventHandler,
    defineView,
} from 'pure-frame';

// Step 1: create pure function component.
const ClickCount = ({ count, increase }) => (
    <>
      <h1>Hello pure-frame</h1>
      <p>
        <label>Count is: </label>
        <span>{count}</span>
      </p>
      <p>
        <button onClick={increase}>Increase</button>
      </p>
    </>
);

// Step 2: define view, injects formulas and declares events.
const ClickCountView = defineView({
    inject: {
        ':count': 'count'
    },
    events: {
        'increase': ':increase'
    }
}, ClickCount);

// Step 3: provide data (from application global state) for component.
defineExtractor(':count', 'count');

// Step 4: handle event from component.
defineStateEventHandler(':increase', state =>
    state.update('count', count => count + 1));

// Step 5: Compose components.
ReactDOM.render(
    <PureFrameRoot state={{ count: 0 }}>
      <ClickCountView />
    </PureFrameRoot>,
    document.getElementById('app')
);

Step 3: start

yarn react-scripts start

exapmle.png

You might also like...
A high-performance framework with fine-grained observable-based reactivity for building rich applications

A high-performance framework with fine-grained observable-based reactivity for building rich applications

A declarative, efficient, and flexible JavaScript library for building user interfaces.

React · React is a JavaScript library for building user interfaces. Declarative: React makes it painless to create interactive UIs. Design simple view

single-spa.js is an Open Source framework for bringing together multiple JavaScript microfrontends in a frontend application.

single-spa.js is an Open Source framework for bringing together multiple JavaScript microfrontends in a frontend application.

Declarative data-fetching and caching framework for REST APIs with React
Declarative data-fetching and caching framework for REST APIs with React

Declarative data-fetching and caching framework for REST APIs with React

Web App using react framework

waldo.vision This is the website for waldo-anticheat :D Libraries used: React React-router React-router-hash-link React-helmet TODO: improve this list

A system combining classical traces dumping tools and a ReactJS web app for live 3D graph rendering of streamed graph data derived from traces
A system combining classical traces dumping tools and a ReactJS web app for live 3D graph rendering of streamed graph data derived from traces

The DynaGraph framework: a system combining classical traces dumping tools (i.e. the tshark tool and Firefox's Network Monitor component) and a ReactJS web app for live 3D graph rendering of streamed graph data derived from traces

Create a SPA project using Mithril JS framework and design layout by JSX syntax and use Typescript and Vite for build system.
Create a SPA project using Mithril JS framework and design layout by JSX syntax and use Typescript and Vite for build system.

Mithril TS(Type script) JSX Create a SPA project using Mithril JS framework and design layout by JSX syntax and use Typescript and Vite for build syst

The Full-stack Framework for React and other in Deno.

The Full-stack Framework for React and other in Deno.

🛡️ ⚛️ A simple, scalable, and powerful architecture for building production ready React applications.

🛡️ ⚛️ A simple, scalable, and powerful architecture for building production ready React applications.

Owner
Joe
Joe
Datapod for React - a framework which extends create-react-app to enables you to quickly build data-driven sites

This is a framework which extends create-react-app to enables you to quickly build data-driven sites. This code is generated from the Datapod-for-React Core application.

Edward Tanguay 1 Mar 19, 2022
🧰 A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps

?? A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps

Noah Zinsmeister 4.7k Jan 5, 2023
web3-react🧰 A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps

?? A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps

Noah Zinsmeister 4.7k Jan 9, 2023
A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps

A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps

Web & Blockchain 1 Nov 1, 2021
A web framework for building virtual reality experiences (VR Web)

Virtual Reality Made Simple: A-Frame handles the 3D and WebVR boilerplate required to get running across platforms including mobile, desktop, Vive, and Rift

Kevin Ngo 9 Sep 15, 2022
A light-weight, comprehensive, reactive framework for business logic and when things change.

watchlight.dev v1.0.15 beta << For when things change. A light-weight, comprehensive, reactive framework for business logic and when things change. In

Simon Y. Blackwell 6 Dec 30, 2022
🌟 DataFormsJS 🌟 A minimal JavaScript Framework, standalone React and Web Components, and JSX Compiler for rapid development of high quality websites and single page applications.

?? DataFormsJS ?? A minimal JavaScript Framework, standalone React and Web Components, and JSX Compiler for rapid development of high quality websites and single page applications.

DataFormsJS 156 Dec 8, 2022
Build blazing fast, modern apps and websites with React

Gatsby v2 ⚛️ ?? ?? Fast in every way that matters Gatsby is a free and open source framework based on React that helps developers build blazing fast w

Gatsby 54k Jan 6, 2023
A frontend Framework for building B2B applications running in the browser on top of REST/GraphQL APIs, using ES6, React and Material Design

react-admin A frontend Framework for building data-driven applications running in the browser on top of REST/GraphQL APIs, using ES6, React and Materi

marmelab 21.3k Jan 6, 2023
Hydrogen is a React-based framework for building dynamic, Shopify-powered custom storefronts.

Hydrogen is a React-based framework for building dynamic, Shopify-powered custom storefronts.

Shopify 3.8k Jan 4, 2023