FluxNext-Generation Reactivity for Luau
Write less. Type better. Run faster.
Write less. Type better. Run faster.
Building software shouldn't feel like a chore. Flux strips away the boilerplate, leaving you with clean, declarative code. State, derived values, and instances flow together naturally without the visual noise.
local Flux = require(ReplicatedStorage.Flux)
local new = Flux.new
-- Create reactive state
local count = Flux(0)
-- Declaratively build instances
local button = new "TextButton" {
Name = "Counter",
Size = UDim2.fromOffset(200, 50),
-- Operator overloading: reads count reactively
Text = function() return `Clicks: {count * 1}` end,
-- Connect to event
Activated = function()
count(count + 1) -- __call to set; arithmetic reads count automatically
end,
}Never guess a property name again. Flux is built from the ground up to respect Luau's strict typechecker. You get perfect IntelliSense and autocompletion for every creatable instance, property, event, and directive out of the box.
-- ✅ Full IDE autocomplete triggers for BackgroundTransparency, BorderSizePixel, etc.
local frame = new "Frame" {
BackgroundColor3 = Color3.new(1, 0, 0),
Size = UDim2.fromScale(1, 1),
TypoProperty = true, -- 'TypoProperty' is not a valid property of 'Frame'
}Inspired by Reactively and SolidJS, Flux uses a highly optimized, lazily evaluated reactive graph. Effects are deferred to the end of the frame by default, derived state only recalculates when it is actively observed and its dependencies have actually changed.
local count = Flux(0)
local expensiveMath = Flux(function()
print("Crunching numbers...")
return count ^ 100
end)
-- "Crunching numbers..." is NEVER printed here.
-- State is updated, but lazy evaluation ensures the math is deferred until it is needed.
count(5)
count(10)