https://github.com/reduxkotlin/redux-kotlin-compose
Compose Multiplatform integration for Redux-Kotlin
https://github.com/reduxkotlin/redux-kotlin-compose
compose-multiplatform kotlin-multiplatform redux-kotlin
Last synced: 3 months ago
JSON representation
Compose Multiplatform integration for Redux-Kotlin
- Host: GitHub
- URL: https://github.com/reduxkotlin/redux-kotlin-compose
- Owner: reduxkotlin
- Created: 2022-08-08T08:29:16.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-08-15T16:51:27.000Z (4 months ago)
- Last Synced: 2025-08-15T18:41:42.283Z (4 months ago)
- Topics: compose-multiplatform, kotlin-multiplatform, redux-kotlin
- Language: Kotlin
- Homepage: https://reduxkotlin.github.io/redux-kotlin-compose
- Size: 601 KB
- Stars: 30
- Watchers: 2
- Forks: 2
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[](https://github.com/reduxkotlin/redux-kotlin-compose/actions/workflows/release.yml)![badge][badge-android]
![badge][badge-js]
![badge][badge-jvm]
[](https://kotlinlang.slack.com/archives/C8A8G5F9Q)
[](http://reduxkotlin.github.io/redux-kotlin-compose)
[](https://mvnrepository.com/artifact/org.reduxkotlin/redux-kotlin-compose/latest)
[](https://oss.sonatype.org/content/repositories/snapshots/org/reduxkotlin/redux-kotlin-compose/)
# Redux-Kotlin-Compose
[Compose Multiplatform] integration for [Redux Kotlin]
## Installation
Artifacts are hosted on maven central. For multiplatform, add the following to your shared module:
```kotlin
kotlin {
sourceSets {
commonMain {
dependencies {
implementation("org.reduxkotlin:redux-kotlin-compose:_")
}
}
}
}
```
For JVM only:
```kotlin
dependencies {
implementation("org.reduxkotlin:redux-kotlin-compose-jvm:_")
}
```
## Usage
```kotlin
data class State(val name: String? = null)
sealed interface Action {
data class Rename(val name: String) : Action
object ClearName : Action
}
val reducer: Reducer = reducerForActionType { state, action ->
when (action) {
is Action.Rename -> state.copy(name = action.name)
is Action.ClearName -> state.copy(name = null)
}
}
@Composable
fun App() {
StoreProvider(createStore(reducer, State())) {
Component()
}
}
@Composable
fun Component() {
val name by selectState { name }
val dispatch = rememberDispatcher()
Text(name)
Button(
text = "Clear",
onClick = {
dispatch(ClearName)
}
)
}
```
[badge-android]: http://img.shields.io/badge/platform-android-brightgreen.svg?style=flat-square
[badge-js]: http://img.shields.io/badge/platform-js-yellow.svg?style=flat-square
[badge-jvm]: http://img.shields.io/badge/platform-jvm-orange.svg?style=flat-square
[Compose Multiplatform]: https://github.com/JetBrains/compose-jb
[Redux Kotlin]: https://github.com/reduxkotlin/redux-kotlin