use-plight
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

usePlight

Taking a step back from react back to JS. A simpler alternative to useState, no more set functions, just change the variable.

const Button: FC = () => {
  const $ = usePlight({ x: 0 });

  const handleClick = () => ++$.x;

  return <button onClick={handleClick}>Increment: "{$.x}"</button>;
};
const Input: FC = () => {
  const $ = usePlight({ name: "" });
  return <input value={$.name} onChange={({ target }) => ($.name = target.value)} />;
};

Package Sidebar

Install

npm i use-plight

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

10.3 kB

Total Files

21

Last publish

Collaborators

  • jsnanigans