1.4.4-ts.0 • Published 2 years ago

@rbxts/roact v1.4.4-ts.0

Weekly downloads
110
License
-
Repository
-
Last release
2 years 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.createElement"
	},
}

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

1.4.4-ts.0

2 years ago

1.4.2-ts.3

2 years ago

1.4.2-ts.2

2 years ago

1.4.2-ts.0

2 years ago

1.4.0-ts.2

3 years ago

1.4.0-ts.1

3 years ago

1.4.0-ts.0

3 years ago

1.3.0-ts.15

3 years ago

1.3.0-ts.14

3 years ago

1.3.0-ts.13

3 years ago

1.3.0-ts.12

3 years ago

1.3.0-ts.11

3 years ago

1.3.0-ts.10

3 years ago

1.3.0-ts.8

3 years ago

1.3.0-ts.7

3 years ago

1.3.0-ts.6

3 years ago

1.3.0-ts.3

3 years ago

1.3.0-ts.5

3 years ago

1.3.0-ts.4

3 years ago

1.3.0-ts.2

4 years ago

1.3.0-ts.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.3.0-cd22f9c

4 years ago

1.2.0-beta.8

4 years ago

1.1.6

4 years ago

1.2.0-beta.1

4 years ago

1.2.0-beta.0

4 years ago

1.2.0-beta.3

4 years ago

1.2.0-beta.2

4 years ago

1.2.0-beta.5

4 years ago

1.2.0-beta.4

4 years ago

1.2.0-beta.7

4 years ago

1.2.0-beta.6

4 years ago

1.1.5

5 years ago

1.1.10-alpha.0

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago