Skip to content
This repository has been archived by the owner on Jun 25, 2023. It is now read-only.

UgnisSoftware/lape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ARCHIVED: Use valtio or legend-state instead.

Lape

https://ugnissoftware.github.io/lape/

Simple state manager for React built on Proxies.

Supports only the latest browsers.

Example

// STATE.ts
import { lape } from "lape";

export interface State {
  count: number;
  deep: {
    nest: boolean;
  };
}

const defaultState: State = {
  count: 0,
  deep: {
    nest: true,
  },
};

export default lape(defaultState);
// APP.tsx
import { connect } from "lape";
import state from "./state";

const action = () => {
  state.count += 1;
};

class App extends React.Component {
  render() {
    return <div onClick={action}>{state.count}</div>;
  }
}

export default connect(App);