This repository was archived by the owner on Apr 20, 2023. It is now read-only.
Repository navigation
Releases
Releases · bnorm/kotlin-react-function
v0.7.0
All create or this release goes to @DVDAndroid! Thanks again!
New
* Support Kotlin 1.6.10
(#26)
* Support latest version of kotlin-wrappers (pre.286) (#26)
plugins {
kotlin("js") version "1.6.10"
id("com.bnorm.react.kotlin-react-function") version "0.7.0"
}v0.6.0
v0.5.1
Fixes
- Generate components with
functionalComponentrather thanrFunction. (#22)
plugins {
kotlin("js") version "1.5.10"
id("com.bnorm.react.kotlin-react-function") version "0.5.1"
}
dependencies {
implementation("com.bnorm.react:kotlin-react-function:0.5.1")
}v0.5.0
v0.4.0
v0.3.0
v0.2.1
v0.2.0
New Features
- Support React component keys via
@RKeyannotation
plugins {
kotlin("js") version "1.4.0"
id("com.bnorm.react.kotlin-react-function") version "0.2.0"
}
dependencies {
implementation("com.bnorm.react:kotlin-react-function:0.2.0")
}Component Key
To set the key of a React functional component, use the @RKey annotation on a
single parameter to a @RFunction annotated function.
@RFunction
fun RBuilder.ListItem(@RKey item: Item) {
...
}This uses the toString() value of the annotated parameter as the key for the
component. If the value of the key needs to be controlled more explicitly, mark
an unused parameter as the key.
@RFunction
fun RBuilder.Component(... other parameters ..., @RKey key: String) {
// `key` doesn't need to be used to be set as the key of the component
}If the @RKey annotated parameter is null, then the string "null" will be
set as the component key. It is also possible to use default parameters to
derive the key from another parameter.