Forest Logo
search
package_2

rodux-hooks

By @lopi-py

Roblox

Mirrored from Wally

This version ships no README. Showing the README from v0.1.7, mirrored from wally.

Rodux Hooks

This project takes inspiration from solarhorizon/rodux-hooks in order to make it work with Roact17.

Setup

local RoduxHooks = require(path.to.RoduxHooks)
local store = require(path.to.store)

local useStore = RoduxHooks.useStore
local useSelector = RoduxHooks.useSelector
local useDispatch = RoduxHooks.useDispatch

Api

useStore(): Store
useSelector<S, T>(selector: (S) -> T, equalityFn: ((T, T) -> boolean)?): T
useDispatch(): (action: AnyAction) -> ()

Example

local function MyComponent()
    local counter = useSelector(function(state: store.State)
        return state.counter
    end)

    return e("TextLabel", {
        AnchorPoint = Vector2.new(0.5, 0.5),
        Position = UDim2.fromScale(0.5, 0.5),
        Size = UDim2.fromOffset(200, 100),
        Text = `Count: {counter}`,
    })
end

Package Details

Install command (Click to copy)


Version

0.2.13

License

MIT

check_circle

Safe for commercial use

infoThe package archive does not include its license text; the license is declared in its manifest metadata.

Automated license review — not legal advice.