https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
react
  • j

    Jared

    02/27/2019, 10:25 PM
    Is it possible to use Kotlin gradle dependencies inside a create-react-kotlin-app?
    g
    • 2
    • 10
  • b

    Benjamin Charais

    04/21/2019, 3:07 AM
    I wanted to dabble around with the create-react-kotlin-app, and when I go to add in the react router, my webpack wont resolve
    react-router-dom
    g
    • 2
    • 6
  • a

    adam.wilson

    04/29/2019, 3:50 PM
    A colleague and I are attempting to use CRKA with Redux and Router but continually run into errors trying to build our project. Does anyone have a guide, example, or suggestion of alternatives? Our main need is to be able to write a common core in Kotlin for multiple platform UI applications. Our first UI app will be the web (where we have existing React experience), followed by native Android.
    f
    l
    • 3
    • 4
  • l

    Lawik

    05/09/2019, 10:01 AM
    message has been deleted
    b
    • 2
    • 1
  • g

    galex

    05/29/2019, 5:24 PM
    I guess nobody uses React with Kotlin/JS… 😞
    r
    c
    • 3
    • 4
  • r

    Robert Jaros

    06/20/2019, 11:06 PM
    Current version of
    kotlin-wrappers
    is built with Kotlin 1.3.40 but kotlinx.serialization 0.11.0 (https://github.com/JetBrains/kotlin-wrappers/blob/master/versions.gradle). I'm having dependency problem after upgrade, which could be caused by this. Any chance of a quick fix (change to 0.11.1)?
    s
    • 2
    • 1
  • o

    o.semen

    06/24/2019, 12:20 PM
    Can not use
    div
    inside
    RBuilder.render
    . Have no idea even where to look for solution. Can someone guide me a bit ?
    r
    • 2
    • 3
  • o

    o.semen

    07/15/2019, 9:04 AM
    I’ve been trying to specify dependencies with few different approaches:
    implementation(npm("@jetbrains/kotlin-react", "16.6.0-pre.67"))
                    implementation(npm("@jetbrains/kotlin-react-dom", "16.6.0-pre.67"))
    in
    js{}
    and
    js{ browser {} }
    sections as well as
    kotlinFrontend {
        npm {
            dependency("@jetbrains/kotlin-react")
            dependency("@jetbrains/kotlin-react-dom")
    
            dependency("core-js", "^2.0.0")
            dependency("react", "16.8.3")
            dependency("react-dom", "16.8.3")
        }
    }
    but it does not help.
    s
    • 2
    • 2
  • s

    Soren Valle

    07/26/2019, 3:02 PM
    Has anyone used the new Hooks? https://github.com/JetBrains/kotlin-wrappers/issues/116
    c
    t
    • 3
    • 2
  • j

    Joffrey

    08/01/2019, 9:29 PM
    Hi guys, I'm converting a react app to Kotlin. How should I replace relative CSS and PNG imports? Side question, I've tried
    kotlin-styled
    for CSS, but then how to declare a
    background = "url('myImage.png')"
    with a path relative to the current file?
    c
    • 2
    • 2
  • b

    Big Chungus

    08/03/2019, 3:40 PM
    Does anyone knows what the type arguments refers to in these functions of Redux wrappers?:
    external fun <A, T1, R> compose(function1: (T1) -> R, function2: (A) -> T1): (A) -> R
    &
    external fun <S, A, R> createStore(
        reducer: Reducer<S, A>,
        preloadedState: S,
        enhancer: Enhancer<S, Action, Action, A, R>
    ): Store<S, A, R>
    R especially
    r
    j
    • 3
    • 6
  • s

    Soren Valle

    08/04/2019, 12:42 AM
    Anyone get the react router working? If so have you been able to find/use:
    withRouter
    (https://reacttraining.com/react-router/web/api/withRouter). I haven't been able to find it in the wrappers and haven't been successful in calling it myself on my class components.
    b
    • 2
    • 10
  • b

    Big Chungus

    08/05/2019, 7:17 AM
    Is there a kotlin wrapper for redux saga or thunk?
    ➕ 1
    j
    • 2
    • 1
  • r

    rince

    08/10/2019, 4:42 PM
    I want to use this json editor component in my kotlin react app: https://www.npmjs.com/package/jsoneditor-react When I click a button I want a specific Object to be serialized to json and shown in the editor. However I can't figure out how to feed the serialized json string to the editor. (I can statically set the value property of the editor when it loads like this:
    attrs {value = js("""{"a":"b"}""")}
    , however I can't figure out how to pass in a state variable instead)
    s
    • 2
    • 54
  • j

    Juanoterocas

    09/02/2019, 2:33 PM
    hello, I'm trying to use react-modal library https://www.npmjs.com/package/react-modal and I want to write children RDOMBuilder inside, how can I do this?
    d
    • 2
    • 4
  • r

    Rodrigo Silva

    09/30/2019, 1:26 PM
    Hi all. Can I use Material UI with react-kotlin?
    f
    c
    • 3
    • 4
  • t

    Tristan Caron

    10/18/2019, 6:40 PM
    fun RBuilder.modal(children: RBuilder.() -> Unit) {
        createPortal(document.getElementById("modal-root")) {
            div("modal") {
                children()
            }
        }
    }
    m
    • 2
    • 1
  • n

    Nikky

    12/06/2019, 7:26 PM
    i am searching for an example app for how to use kotlin-react with gradle (instead of yarn/npm) ideally using mpp and the frontend plugin is there any trick i am missing to execute the examples here ? https://github.com/JetBrains/kotlin-wrappers i am not seeing any tasks for running npm or html files in the repo...
    s
    s
    • 3
    • 3
  • n

    Nikky

    01/07/2020, 7:31 PM
    so is
    kotlin-dce-js
    incompatible with react or something ? i am getting
    error: duplicate target file will be created for '..../build/js/node_modules/react/index.js' and '..../build/js/node_modules/text-encoding/index.js'
    i am using
    kotlin("js")
    and
    id("kotlin-dce-js")
    plugins on
    1.3.61
    or is there a new dce variant that i should use instead ?
    ⬆️ 1
    p
    • 2
    • 1
  • p

    Paul N

    01/09/2020, 12:04 PM
    What's the best way of doing this in Kotlin ?
    import {faList, faPlus} from "@fortawesome/free-solid-svg-icons";
    Is there a less clunky way than this ?
    @file:JsModule("@fortawesome/free-solid-svg-icons")
    @file:JsNonModule()
    
    import react.*
    
    @JsName("faSyncAlt")
    external val faSyncAlt: RClass<RProps>
    
    @JsName("faPlus")
    external val faPlus: RClass<RProps>
    n
    b
    • 3
    • 4
  • n

    Nikky

    01/09/2020, 3:23 PM
    so.. what do you use to deploy your react app? whats the task to bundle the js, html and everything so i can upload it or package it into my ktor server jar ? or is this something i need to learn webpack configuration for ?
    👍 1
    b
    • 2
    • 10
  • p

    Paul N

    01/12/2020, 9:01 PM
    I'm confused by the code Dukat is generating when converting typescript to Kotlin. If I run for example: dukat ~/git/typed/DefinitelyTyped/types/react-bootstrap/index.d.ts It's generating code that doesn't compile:
    external open class Dropdown : React.Component<DropdownBaseProps /* Dropdown.DropdownBaseProps & React.HTMLProps<Dropdown> */> {
    IntelliJ can't find an import for React.Component. Does anyone know how to resolved the missing dependency ?
    n
    b
    e
    • 4
    • 5
  • n

    Nikky

    01/13/2020, 10:16 AM
    if someone could walk me through converting one of the generated files for
    @types/react-bootstrap
    to usable external declarations.. i might be bored enough to translate the rest but i am not even sure where to start....
    e
    • 2
    • 1
  • n

    Nikky

    01/14/2020, 5:29 PM
    sure looks like we have no way to use existing components right now 😞
    b
    j
    • 3
    • 3
  • r

    ribesg

    02/08/2020, 9:36 PM
    I've got an issue with Hooks, this issue https://github.com/JetBrains/kotlin-wrappers/issues/127#issuecomment-583779240
    • 1
    • 1
  • g

    Gurupad Mamadapur [FH]

    02/27/2020, 8:56 AM
    How to initialize component state based on props - Tried both -
    override fun InputState.init() {
        // props is undefined here
    }
    
    override fun InputState.init(props: InputProps) {
       // Not called
    }
    code doc also mentions -
    // if you use this method, don't forget to pass props to the constructor first
    open fun S.init(props: P) {}
    But how do I pass props to the constructor?
    s
    • 2
    • 2
  • r

    Roger Kreienbühl

    03/09/2020, 9:40 AM
    Hi I am relatively new to Kotlin-React. I try to use the react-grid-layout (https://github.com/STRML/react-grid-layout) with Kotlin. Therefore I made the following interface file:
    @file:JsModule("react-grid-layout")
    @file:JsNonModule
    
    import kotlinext.js.Object
    import react.RClass
    import react.RProps
    
    @JsName("default")
    external val ReactGridLayout: RClass<GridLayoutProps>
    
    external interface GridLayoutProps: RProps {
        var autoSize: Boolean
        var cols: Int
        var calssName: String
        var style: Object
        var draggableHandle: String
        var draggableCancel: String
        var containerPadding: Any
        var rowHeight: Int
        var maxRows: Int
        var layout: Array<IntArray>
        var margin: Array<Int>
        var isDraggable: Boolean
        var isResizable: Boolean
        var isDroppable: Boolean
        var useCSSTransforms: Boolean
        var transformScale: Int
        var verticalCompact: Boolean
        var compactType: String?
        var preventCollision: Boolean
        var droppingItem: Object
        var onLayoutChange: Any
        var onDragStart: Any
        var onDrag: Any
        var onDragStop: Any
        var onResizeStart: Any
        var onResize: Any
        var onResizeStop: Any
        var onDrop: Any
    }
    When I now try to use this, I only get errors. What am I doing wrong?
    g
    • 2
    • 13
  • d

    Darren Bell

    03/20/2020, 11:01 AM
    Could someone provide a example of using
    useEffectWithCleanup
    to fire only when I have a specific state change. For example, I want the cleanup to happen only when my submitted state changes.
    r
    • 2
    • 2
  • j

    Joffrey

    03/24/2020, 10:33 AM
    Has anyone tried/managed to use Redux dev tools with kotlin-redux wrapper?
    r
    • 2
    • 4
  • p

    Paul N

    04/27/2020, 8:46 AM
    What port is used for browserDevelopmentRun/run ? I'm going through this tutorial from Jetbrains https://play.kotlinlang.org/hands-on/Building%20Web%20Applications%20with%20React%20and%20Kotlin%20JS/02_Setting_up and when it launches http://localhost:8080 in the browser I get connection refused.
    b
    s
    • 3
    • 4
Powered by Linen
Title
p

Paul N

04/27/2020, 8:46 AM
What port is used for browserDevelopmentRun/run ? I'm going through this tutorial from Jetbrains https://play.kotlinlang.org/hands-on/Building%20Web%20Applications%20with%20React%20and%20Kotlin%20JS/02_Setting_up and when it launches http://localhost:8080 in the browser I get connection refused.
b

Björn Mayer

04/27/2020, 8:53 AM
It is 8080. If you like to change it: https://webpack.js.org/configuration/dev-server/
p

Paul N

04/27/2020, 8:57 AM
Thanks - there's obviously something up in the above project - I'll add an issue on Github for it.
s

Sebastian Aigner

04/28/2020, 12:04 PM
Hi @Paul N, I wrote the hands-on you mentioned above. Let me know if I of help, or if you managed to resolve the issue yourself. 🙂
p

Paul N

04/28/2020, 2:43 PM
Hi @Sebastian Aigner it turned out that it was a Chrome issue. For whatever reason Chrome (running in my Ubuntu VM) didn't like localhost:8080 even though Firefox and curl worked fine. I ended up just using 127.0.1.1:8080 in Chrome instead. Great article by the way, really really good.
🎉 1
👍🏼 1
View count: 4