lape
v6.4.8
Published
State manager for React
Downloads
1,356
Readme
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);