Roact-Rodux is an ergonomic binding between Roact, a view library, and Rodux, a state management library.
It is the recommended way to use the two libraries together, and is similar in scope to react-redux, the equivalent library for React and Redux.
All documentation for Roact-Rodux is available on the official docs website. It includes:
This fork requires you to pass in an array of store state keys as the first argument to RoactRodux.connect
. This ensures that you have control over which bits of state trigger rerenders for your component.
Here's an example that shows how to link RoactRodux with a basic currency display:
--[[
Rodux store state:
{
Coins = 50,
Gems = 100,
Inventory = {...},
UserPreferences = {...}
}
]]
-- Connecting your component --
RoactRodux.connect({
"Coins",
"Gems"
}, function(state)
return {
coins = state.Coins,
gems = state.Gems
}
end, function(dispatch)
return {
...
}
end)(CurrencyDisplayComponent)
Contributions to Roact-Rodux are welcome! Details are available in the contributing guide.
Roact-Rodux is available under the Apache 2.0 license. See LICENSE for details.