redity
v1.0.1
Published
Library for render control
Downloads
70
Readme
Redity
Render generator. Redity Is a library for render control. Intended to have states outside the component tree.
npm install redity
Read the documentation here.
Example
// controller.js
import { render } from "redity";
const KEYNAME = "MY_KEYNAME";
export const store = {
message: "",
};
export function handleClick() {
store.message = "Welcome to Redity! 😄";
render(KEYNAME);
}
// MyComponent.jsx
import { useRender } from "redity";
import { store, handleClick, KEYNAME } from "./Controller";
export default function MyComponent() {
useRender(KEYNAME);
return (
<div>
<p>{store.message}</p>
<button onClick={handleClick}>Click me! :D</button>
</div>
);
}
Requirements
- react: "^16.8.0"