reduxkotlin-reselect

Redux reselect implementation for Redux-Kotlin. Mulitiplatform supported.

License

License

Categories

Categories

Kotlin Languages
GroupId

GroupId

org.reduxkotlin
ArtifactId

ArtifactId

reselect-jvm
Last Version

Last Version

0.5.5
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

reduxkotlin-reselect
Redux reselect implementation for Redux-Kotlin. Mulitiplatform supported.
Project URL

Project URL

https://github.com/reduxkotlin/Reselect/
Source Code Management

Source Code Management

https://github.com/reduxkotlin/Reselect/

Download reselect-jvm

Dependencies

compile (2)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib jar 1.4.0
org.jetbrains.kotlin : kotlin-stdlib-common jar 1.4.0

runtime (1)

Group / Artifact Type Version
org.reduxkotlin : redux-kotlin-jvm jar 0.5.5

Project Modules

There are no modules declared in this project.

Reselect

CI

badge badge badge badge badge badge badge badge

A Redux Reselect implementation for memoized dispatch on state selectors. Forked from Reduks implementation.

Documentation to come.

Example usage:

Subscribe to a single substate:

//selecting a substate subscribes to changes.  Lambda block will be executed when there is 
//a change in value of `isLoading`
val subscriber: StoreSubscriber = store.select({ it.isLoading }) {
        loadingIndicator.visibility = if (store.state.isLoading) View.VISIBLE else View.GONE
    }

//invoking subcription unsubscribes.  Do this when appropriate for component lifecycle
subscriber()  

Subscribe to multiple substates:

val multiSubscription = store.selectors {
            select({ it.isLoading }) {
                loadingIndicator.visibility = if (store.state.isLoading) View.VISIBLE else View.GONE
            }
            select({ it.name }) {
                nameTextView.text = store.state.name
            }
        }

//unsubscribe when appropriate
multiSubscription()

How to add to project:

Requires Kotlin 1.4.0. Artifacts are hosted on maven central. For multiplatform, add the following to your shared module:

kotlin {
  sourceSets {
        commonMain { //   <---  name may vary on your project
            dependencies {
                implementation "org.reduxkotlin:reselect:0.5.5"
            }
        }
 }

For JVM only:

  implementation "org.reduxkotlin:reselect-jvm:0.5.5"
org.reduxkotlin

Redux-Kotlin

Redux for Kotlin multiplatform

Versions

Version
0.5.5