{"id":19195941,"url":"https://github.com/mercari/rxreduxk","last_synced_at":"2025-05-09T00:33:03.257Z","repository":{"id":51273343,"uuid":"161142695","full_name":"mercari/RxReduxK","owner":"mercari","description":"Micro-framework for Redux implemented in Kotlin","archived":false,"fork":false,"pushed_at":"2023-07-07T13:21:46.000Z","size":164,"stargazers_count":67,"open_issues_count":6,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-04T11:05:27.399Z","etag":null,"topics":["action","android","flux","kotlin","kotlin-android","kotlin-library","micro-framework","reducer","redux","rx","rxredux","state","state-management","store"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mercari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-10T08:31:59.000Z","updated_at":"2024-06-15T17:17:09.000Z","dependencies_parsed_at":"2024-11-09T12:12:10.625Z","dependency_job_id":"d79b8b2c-1c4c-4d99-850b-efd27beeeb27","html_url":"https://github.com/mercari/RxReduxK","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mercari%2FRxReduxK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mercari%2FRxReduxK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mercari%2FRxReduxK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mercari%2FRxReduxK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mercari","download_url":"https://codeload.github.com/mercari/RxReduxK/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171112,"owners_count":21865275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["action","android","flux","kotlin","kotlin-android","kotlin-library","micro-framework","reducer","redux","rx","rxredux","state","state-management","store"],"created_at":"2024-11-09T12:12:02.680Z","updated_at":"2025-05-09T00:33:03.193Z","avatar_url":"https://github.com/mercari.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RxRedux for Kotlin\n\n[![jcenter](https://api.bintray.com/packages/mercari-inc/maven/rxreduxk/images/download.svg)](https://bintray.com/mercari-inc/maven/rxreduxk/_latestVersion)\n[![Build Status](https://circleci.com/gh/mercari/RxReduxK.svg?style=svg)](https://circleci.com/gh/mercari/RxReduxK)\n\nMicro-framework for Redux implemented in Kotlin\n\n## Installation\n\n```\ndependencies {\n  repositories {\n    jcenter()\n  }\n}\n\nimplementation(\"com.mercari.rxredux:rxredux:\u003clatest-version\u003e\")\n```\n\n## Usage\n\nThis framework is composed of several types/abstractions inspired by [Redux](https://redux.js.org/) that help to implement the reactive behavior of application components.\nIt is based on [RxJava](https://github.com/ReactiveX/RxJava) for reactivity and works well with [RemoteDataK](https://github.com/mercari/RemoteDataK).\n\n### State\n\nState represents the model or state of your component or UI.\nA State is recommended to be immutable, however it can be allowed to be mutable.\n\nThis can typically be implemented by a [data class](https://kotlinlang.org/docs/reference/data-classes.html)\n\nFor example:\n\n```kotlin\ndata class CounterState(\n    val counter: Int\n) : State\n```\n\n### Action\n\nAn Action represents the desired modifications on a State, for example\n\n```kotlin\nclass Increment : Action\nclass Decrement : Action\n```\n\nAlthough not required, it is recommended to model Actions as class hierarchy with a [sealed class](https://kotlinlang.org/docs/reference/sealed-classes.html).\n\n```kotlin\nsealed class CounterAction : Action\n\nclass Increment : CounterAction()\nclass Decrement : CounterAction()\n```\n\nAn Action can contain parameters that make them more useful depending on the desired behaviour.\nFor example:\n\n```kotlin\nclass Increment(val by: Int) : CounterAction\n```\n\nActions are to be dispatched through the Store's _dispatch_ method to perform State mutations.\n\nFor example:\n\n```kotlin\nstore.dispatch(Increment(2))\n```\n\n### Reducer\n\nA Reducer is where the State is mutated or modified, depending on which Action is applied.\nIt is basically a map of the desired modifications and their effects.\n\nFor example:\n\n```kotlin\nclass CounterReducer: Reducer\u003cCounterState, CounterAction\u003e {\n    override fun reduce(currentState: CounterState, action: CounterAction) : CounterState =\n        when(action) {\n          is Increment -\u003e CounterState(counter: currenState.counter + action.by)\n          is Decrement -\u003e CounterState(counter: currenState.counter - action.by)\n        }\n}\n```\n\n### Middleware\n\nMiddleware allows for a variety of behaviours that are not directly related to the component's State.\nThis is useful for the implementation of so called cross-cutting concerns such as Logging, by hooking into the sequence of Action events.\n\nMiddleware can run before reducing the state or after depending on the need, this can be achieved by overriding the provided methods.\n\n### Store\n\nThe Store \"stores\" the State, and exposes it for observation as an [Observable](http://reactivex.io/documentation/observable.html). It also connects all the other abstractions together.\n\nTo create a Store, simply instantiate it with an initial State and its related Reducer:\n\n```kotlin\nval counterStore = Store(initialState, reducer)\n```\n\nSeveral middleware can also be added to the Store through the Store's _addMiddleware_ method.\n\n#### Examples\n\nExamples of usage can be seen in the [tests](https://github.com/mercari/RxReduxK/tree/master/rxredux/src/test/java/com/mercari/rxredux)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmercari%2Frxreduxk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmercari%2Frxreduxk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmercari%2Frxreduxk/lists"}