{"id":"vflour/fusionrodux-2","name":"fusionrodux-2","scope":"vflour","platform":"roblox","description":"A rodux binding that's compatible with Fusion 0.2.0","version":"0.1.3","latest":"0.1.3","versions":["0.1.0","0.1.2","0.1.3"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{"elttob/fusion":{"version":"^0.2.0","alias":"Fusion"},"roblox/rodux":{"version":"^3.0.0","alias":"Rodux"}},"integrity":"f1ff55d1ffbbecdcfae32e387f3269300d06a5a86f94313592442e50fcb65f43","likes":0,"downloads":0,"install":"forest install vflour/fusionrodux-2","url":"https://forest.dev/p/roblox/vflour/fusionrodux-2","files":"https://api.forest.dev/ai/package/roblox/vflour/fusionrodux-2/files","readme":"# fusionrodux-2\nImplementation of a rodux binding for Fusion 0.2.x\n\n## Installation\n| Method           | Source             |\n|------------------| -------------      |\n| Wally            | ``FusionRodux = \"vflour/fusionrodux-2@0.1.0\"``  |\n| Binary `(.rbxm)` | [Latest release](https://github.com/vflour/fusion-rodux-2/releases/tag/0.1.0) |\n\n## Contributing\nContributions are welcome! Feel free to open and issue and/or submit a pull request :-)\n\n## Usage\nThis package is intended to be used with Wally and Rojo! Make sure to run ``wally install`` before serving or building with Rojo.\n\n### Requiring\nFirst (and most importantly), you need to actually require it! Make sure it's parented to a folder where Fusion and Rodux sits (this is mainly because this package is intended to be paired with Wally). \n\n```\nlocal Packages = game.ReplicatedStorage.Packages\nlocal Fusion = require(Packages.Fusion) -- sample Fusion require\nlocal FusionRodux = require(Packages.FusionRodux)\n```\n\n### Using with components\nNow you're ready to use FusionRodux! It's supposed to work like any other dependency in Fusion, so all you really need to do is call it so that it'll bind to the store you pass it to.\n\nThe first argument is the store you'll be connecting to. The second argument is the processor function that updates which value inside of the store you want to be tracking.\n\nThe first value that it returns is a Value that contains the returned value of the processor you just passed to it. It's kind of like a Computed, but without any dependencies.\n\n( We'll get to the second returned value in the next section )\n\n_Do note that this means that the processor will not be executed if a dependency inside of the processor body is updated._\n\n```\nlocal Packages = game.ReplicatedStorage.Packages\nlocal Fusion = require(Packages.Fusion) -- sample Fusion require\nlocal FusionRodux = require(Packages.FusionRodux)\nlocal store = require(script.Parent.store)\n\nlocal New = Fusion.New\n\nfunction PersonNameTag(props)\n    local name = FusionRodux(store, function(newState)\n        return newState.name\n    end)\n    \n    return New \"TextLabel\" {\n        Name = \"NameTag\",\n        Size = UDim2.fromOffset(100, 100),\n        Text = name\n    }\nend\n```\n\n### Cleaning up\nSince FusionRodux connects to the state, you need to explicitly tell it when to clean up that connection. \n\n...which is where second return value comes to the rescue! \n\nFeel free to pair it with the Cleanup SpecialKey in Fusion\n\n```\nlocal Packages = game.ReplicatedStorage.Packages\nlocal Fusion = require(Packages.Fusion) -- sample Fusion require\nlocal FusionRodux = require(Packages.FusionRodux)\nlocal store = require(script.Parent.store)\n\nlocal New = Fusion.New\n\nfunction PersonNameTag(props)\n    local name, disconnect = FusionRodux(store, function(newState)\n        return newState.name\n    end)\n    return New \"TextLabel\" {\n        Name = \"NameTag\",\n        Size = UDim2.fromOffset(100, 100),\n        Text = name,\n\n        [Cleanup] = function()\n            disconnect()\n        end\n    }\nend\n```\n\n### Test Example\nYou can also open up the test story (make sure to have [Hoarcekat installed as a plugin](https://github.com/Kampfkarren/hoarcekat)) to see how it works by serving ``test.project.json`` via Rojo. \n\nThe test story is stored under ``/tests/test.story.lua`` if you want take a look at how it works. It depends on the ``/tests/data.lua`` file to manage the stores and actions.\n\n","readmeTruncated":false}