Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 776 Bytes

README.md

File metadata and controls

39 lines (29 loc) · 776 Bytes

Fusion Reflex

A port of react-reflex for Fusion 0.3

Installing

Pesde

pesde add synpixel/fusion_reflex

Example

local scope = Fusion:scoped(FusionReflex, { Producer = producer })

local count = scope:Selector(function(state)
	return state.count
end)

scope:New "TextButton" {
	Text = scope:Computed(function(use)
		return `Count: {use(count)}`
	end),
	AnchorPoint = Vector2.new(0.5, 0.5),
	Size = UDim2.new(0, 100, 0, 50),
	Position = UDim2.new(0.5, 0, 0.5, 0),
	Parent = playerGui,

	[Fusion.OnEvent "MouseButton1Click"] = function()
		scope.Producer.increment()
	end,

	[Fusion.OnEvent "MouseButton2Click"] = function()
		scope.Producer.decrement()
	end,
}