Why are the router extensions deprecated?
See original GitHub issueSince I upgraded to latest versions of Kotlin wrappers, my usages of router extensions are marked as deprecated.
The ReplaceWith
is broken so I had to manually replace the function calls.
What is the reason for the deprecation? Is there an alternative to using the raw component directly?
It really looks awkward now. I used to have this:
fun RBuilder.application() = hashRouter {
errorDialog()
switch {
route(Route.GAME_BROWSER.path) { gameBrowser() }
route(Route.GAME.path) { gameScene() }
route(Route.LOBBY.path) { lobby() }
route(Route.HOME.path, exact = true) { home() }
redirect(from = "*", to = "/")
}
}
And now I have to replace with:
fun RBuilder.application() = HashRouter {
errorDialog()
Switch {
Route {
attrs.path = arrayOf(Route.GAME_BROWSER.path)
gameBrowser()
}
Route {
attrs.path = arrayOf(Route.GAME.path)
gameScene()
}
Route {
attrs.path = arrayOf(Route.LOBBY.path)
lobby()
}
Route {
attrs.path = arrayOf(Route.HOME.path)
home()
}
Redirect {
attrs {
from = "*"
to = "/"
}
}
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Important changes (deprecations) coming in Power Apps and ...
"Deprecated" means we intend to remove the feature or capability from a future release. The feature or capability will continue to work and...
Read more >1.14.0 (July 7, 2020) - Envoy Proxy
A mapping of extension names is available in the deprecated documentation. ... deprecated documentation. thrift_proxy: added router filter stats to docs.
Read more >RFC 5095: Deprecation of Type 0 Routing Headers in IPv6
The purpose of this document is to deprecate a feature of IPv6 that has been shown to have undesirable security implications.
Read more >Deprecated API Migration Guide - Kubernetes
When APIs evolve, the old API is deprecated and eventually removed. This page contains information you need to know when migrating fromĀ ...
Read more >Private Network Access update: Introducing a deprecation trial
Deprecation trials allow Chrome to deprecate certain web features and prevent websites from forming new dependencies on them, while at the sameĀ ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for getting back to me @sgrishchenko š
I totally understand, maintaining and extending those functions as ReactRouter evolves is a lot of work. I think for the time being weāll have to copy the deprecated functions we are using into our codebase and we can maintain them as needed.
Thanks also for sharing
kotlin-react-function
project, Iāll have a look at it later.@francos you absolutely right, there is such a problem now, but this problem is present for each component in current DSL implementation: there is not way to set all props for component safely. We, maintainers, are thinking about solution for it, but we want to provide general solution. I think it does not fare to make wrapper for Router more complex and to add a lot of boilerplate code there because of DSL problems.
At the same time we cant provide solution right now. Probable solution is compiler plugin, but there is not appropriate API for compiler plugin in Legacy compiler and we have to provide compatibility for both IR and Legacy compilers until IR compilers is stable.
As temporary solution I can offer you to check this project, may be it will help you