@rbxts/better-binding
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Better Binding

A better binding for Roact!

rightCardProps: CardProps = {
    visible: new BetterBinding<boolean>(false),
    position: new BetterBinding(new UDim2()),
    title: new BetterBinding(""),
    description: new BetterBinding(""),
    image: new BetterBinding<number | undefined>(undefined),
    groupID: new BetterBinding<number | undefined>(undefined),
    focusedMotor: new SingleMotor(0),
};
interface CardComponentProps {
    visible: Roact.Binding<boolean>;
    position: Roact.Binding<UDim2>;
    title: Roact.Binding<string>;
    description: Roact.Binding<string>;
    image: Roact.Binding<number | undefined>;
    groupID: Roact.Binding<number | undefined>;
    focusedMotor: SingleMotor;
}

Instead of returning an annoying tuple with a separate function to set the value, you can just use the BetterBinding. The BetterBinding class implements Roact.Binding, so you can use it just like a normal binding with Roact components!

This was pulled from one of my old projects, and it's pretty useful if you don't like dealing with regular bindings.

Readme

Keywords

none

Package Sidebar

Install

npm i @rbxts/better-binding

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

6.43 kB

Total Files

5

Last publish

Collaborators

  • jheinem1