{"id":"quamatic/rbx-react-redux","name":"rbx-react-redux","scope":"quamatic","platform":"roblox","description":"React bindings for Roblox Redux.","version":"1.0.0","latest":"1.0.0","versions":["1.0.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{"core-packages/react":{"version":"^17.0.1-rc.19","alias":"React"},"core-packages/react-roblox":{"version":"^17.0.1-rc.19","alias":"ReactRoblox"},"quamatic/rbx-redux":{"version":"^1.0.0","alias":"Redux"}},"integrity":"a076f0f2ab1a93faf63d8eab2d0305c511ac958701bf9b81e4fb75fb5b950bdc","likes":0,"downloads":0,"install":"forest install quamatic/rbx-react-redux","url":"https://forest.dev/p/roblox/quamatic/rbx-react-redux","files":"https://api.forest.dev/ai/package/roblox/quamatic/rbx-react-redux/files","readme":"# rbx-react-redux\r\nPerformant React bindings for `rbx-redux`\r\n \r\n# Installation\r\nWally package coming soon.\r\n\r\n# Usage Guide\r\n## Passing a Store\r\n```lua\r\n-- App.lua\r\nlocal React = require(Path.To.React)\r\nlocal ReactRedux = require(Path.To.ReactRedux)\r\n\r\nlocal store = require(Path.To.Your.Redux.Store)\r\n\r\nlocal SomeRandomElement = ...\r\n\r\nlocal function App()\r\n    return React.createElement(ReactRedux.Provider, {\r\n        store = store,\r\n    }, React.createElement(SomeRandomElement))\r\nend\r\n\r\n-- OR --\r\n\r\n-- Using another component for the sake of readability\r\nlocal function StoreConsumers()\r\n    return e(React.Fragment, nil, {\r\n        SomeRandomElement = React.createElement(SomeRandomElement)\r\n    })\r\nend\r\n\r\nlocal function App()\r\n    return React.createElement(ReactRedux.Provider, {\r\n        store = store,\r\n    }, e(StoreConsumers))\r\nend\r\n```\r\n\r\n## Basic Counter Example\r\n```lua\r\n-- Counter.lua\r\nlocal React = require(Path.To.React)\r\nlocal ReactRedux = require(Path.To.ReactRedux)\r\n\r\nlocal counterActions = require(Path.To.Some.Slice.With.Actions)\r\n\r\nlocal function Counter()\r\n    local count = ReactRedux.useSelector(function(state)\r\n        -- State start as { counter = 0 } for example purposes.\r\n        return state.counter.value\r\n    end)\r\n\r\n    local dispatch = ReactRedux.useDispatch()\r\n\r\n    return React.createElement(\"TextLabel\", {\r\n        Text = `Counter: {count}`,\r\n\r\n        [React.Event.Activated] = function()\r\n            -- Increment counter\r\n            dispatch(counterActions.increment())\r\n        end,\r\n\r\n        [React.Event.MouseButton2Click] = function()\r\n            -- Decrement counter\r\n            dispatch(counterActions.decrement())\r\n        end,\r\n    })\r\nend\r\n```\r\n","readmeTruncated":false}