0.0.2 • Published 2 years ago

use-plight v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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)} />;
};