3.0.1 • Published 10 months ago

@rbxts/roact v3.0.1

Weekly downloads
110
License
-
Repository
-
Last release
10 months ago

Installation

You can install it via npm i @rbxts/roact.

Usage

For a detailed guide and examples, check out the official Roact documentation. The Wiki on this repository will have guides on how to adapt to using typescript instead of Lua.

Required tsconfig.json settings

You will need the settings from roblox-ts, as well as:

{
	"compilerOptions": {
		"jsx": "react",
		"jsxFactory": "Roact.jsx",
		"jsxFragmentFactory": "Roact.Fragment",
	},
}

Regular TypeScript

import Roact from '@rbxts/roact';

const LocalPlayer = game.GetService("Players").LocalPlayer as Player;
const PlayerGui = LocalPlayer.FindFirstChildOfClass("PlayerGui");

const tree = Roact.createElement("ScreenGui", {}, {
  Label: Roact.createElement("TextLabel", {
    Text: "Hello, World!",
    Size: new UDim2(1, 0, 1, 0)
  }),
});

Roact.mount(tree, PlayerGui, "HelloWorld");

JSX Typescript (.tsx files)

import Roact from '@rbxts/roact';

const LocalPlayer = game.GetService("Players").LocalPlayer as Player;
const PlayerGui = LocalPlayer.FindFirstChildOfClass("PlayerGui");

const tree = <screengui>
  <textlabel Key="Label" Text="Hello, World!" Size={new UDim2(1, 0, 1, 0)}/>
</screengui>;

Roact.mount(tree, PlayerGui, "HelloWorld");

License

The original Roact library's License can be found here: Roact License

3.0.1

10 months ago

3.0.0

10 months ago

1.4.4-ts.0

3 years ago

1.4.2-ts.3

3 years ago

1.4.2-ts.2

3 years ago

1.4.2-ts.0

3 years ago

1.4.0-ts.2

4 years ago

1.4.0-ts.1

4 years ago

1.4.0-ts.0

4 years ago

1.3.0-ts.15

4 years ago

1.3.0-ts.14

4 years ago

1.3.0-ts.13

4 years ago

1.3.0-ts.12

4 years ago

1.3.0-ts.11

4 years ago

1.3.0-ts.10

4 years ago

1.3.0-ts.8

5 years ago

1.3.0-ts.7

5 years ago

1.3.0-ts.6

5 years ago

1.3.0-ts.3

5 years ago

1.3.0-ts.5

5 years ago

1.3.0-ts.4

5 years ago

1.3.0-ts.2

5 years ago

1.3.0-ts.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.3.0-cd22f9c

5 years ago

1.2.0-beta.8

5 years ago

1.1.6

5 years ago

1.2.0-beta.1

5 years ago

1.2.0-beta.0

5 years ago

1.2.0-beta.3

5 years ago

1.2.0-beta.2

5 years ago

1.2.0-beta.5

5 years ago

1.2.0-beta.4

5 years ago

1.2.0-beta.7

5 years ago

1.2.0-beta.6

5 years ago

1.1.5

6 years ago

1.1.10-alpha.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago