@jetbrains/kotlin-react-router-dom

4.3.1-pre.91 • Public • Published

kotlin-react-dom

Kotlin wrapper for React Router DOM library. Major version number of this wrapper matches that of React Router DOM itself.

Both BrowserRouter and HashRouter are supported.

Installation

  1. npm i @jetbrains/kotlin-react-router-dom

  2. npm run gen-idea-libs

See the Bintray page for Maven and Gradle installation instructions.

Examples

interface IdProps : RProps {
    var id: Int
}

class RootComponent : RComponent<RProps, RState>() {
    override fun RBuilder.render() {
        hashRouter { // or "browserRouter"
            switch {
                route("/", IndexComponent::class, exact = true)
                route("/login", strict = true) {
                    login(providers = listOf("plain", "facebook"))
                    a(href = "#/") {
                        +"Back"
                    }
                }
                route<IdProps>("/user/:id") { props ->
                    div {
                        +"User id: ${props.match.params.id}"
                    }
                }
                redirect(from = "/redirect", to = "/redirected")
            }
        }
    }
}

Tutorial

See lawik123/kotlin-poc-frontend-react-redux. This project is an implementation/translation of the react-redux Todo List example project in Kotlin (with the addition of react-router).

Readme

Keywords

none

Package Sidebar

Install

npm i @jetbrains/kotlin-react-router-dom

Weekly Downloads

16

Version

4.3.1-pre.91

License

Apache-2-0

Unpacked Size

23.8 kB

Total Files

6

Last publish

Collaborators

  • skoch13
  • jetbrains-admin
  • kotlin
  • jetbrains-buildserver
  • allvo
  • bashor
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy