Skip to main content

Roact Reflex

The official bindings for Reflex and Roact Hooked are available under @rbxts/roact-reflex.

Luau is not supported by Roact Hooked or Roact Reflex.

See the source code on GitHub →


Components

Roact Reflex allows you to use your root producer from Roact function components. It exposes a component that you can use to specify the producer for Hooks to use:

Roact.mount(
<ReflexProvider producer={producer}>
<App />
</ReflexProvider>,
playerGui,
);

Hooks

You can use Hooks to read and subscribe to state, or to dispatch actions. Use these Hooks in function components that are wrapped in a <ReflexProvider>.

Context Hooks

Use these Hooks to access the root producer and dispatch actions:

function Button() {
const { increment } = useProducer();
// ...

State Hooks

Use these Hooks to read and subscribe to state:

function Counter() {
const count = useSelector((state) => state.count);
// ...