JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 171
  • Score
    100M100P100Q101842F
  • License MIT

Roact hooks based on Kampfkarren's hooks & React Hooks

Package Exports

  • @rbxts/roact-hooked

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@rbxts/roact-hooked) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@rbxts/roact-hooked

Roact hooks based on Kampfkarren's hooks & React Hooks

✋🏾 This is a work in progress!

Usage

import { hooked, useEffect, useState } from "@rbxts/roact-hooked";
import Roact from "@rbxts/roact";

interface MyComponentProps {
  name?: string;
}

export const MyComponent = hooked<MyComponentProps>(({ name = "David Baszucki" }) => {
  const [count, setCount] = useState(0);

  useEffect(() => {
    print("Counter: " + count);
  }, [count]);

  return (
    <textbutton
      Size={new UDim2(1, 0, 1, 0)}
      Text={`${name} pressed ${count} times`}
      Event={{
        Activated: () => setCount((value) => value + 1),
      }}
    />
  );
});