[ReactRouterDom] HashType undefined
See original GitHub issueI tried out the react router examples linked in the readme and from this PR: https://github.com/JetBrains/kotlin-wrappers/pull/172
In both examples i get: TypeError: $module$react_router_dom.HashType is undefined
in the console of the browser (Firefox 77.0.1, Chrome 83.0.4103.116, Safari 13.1) and i just get a blank screen.
Versions used:
val reactVersion = "16.13.1"
val reactRouterVersion = "5.1.2"
val kotlinWrapperVersion = "pre.109-kotlin-1.3.72"
Some reproduction code:
val Home = functionalComponent<RProps> { h2 { +"Home" } }
val About = functionalComponent<RProps> { h2 { +"About" } }
val Topics = functionalComponent<RProps> {
val match = useRouteMatch<RProps>() ?: return@functionalComponent
div {
h2 { +"Topics" }
ul {
li {
routeLink("${match.url}/components") { +"Components" }
}
li {
routeLink("${match.url}/props-v-state") { +"Props v. State" }
}
}
switch {
route("${match.path}/:topicId") { child(Topic) }
route(match.path) {
h3 { +"Please select a topic." }
}
}
}
}
external interface TopicProps : RProps {
val topicId: String
}
val Topic = functionalComponent<RProps> {
val topicId = useParams<TopicProps>()?.topicId ?: return@functionalComponent
h3 { +"Requested topic ID: $topicId" }
}
fun RBuilder.appWithRouter() {
browserRouter {
div {
ul {
li {
routeLink("/") { +"Home" }
}
li {
routeLink("/about") { +"About" }
}
li {
routeLink("/topics") { +"Topics" }
}
}
switch {
route("/about") { child(About) }
route("/topics") { child(Topics) }
route("/") { child(Home) }
}
}
}
}
fun main() {
render(document.getElementById("app")) {
appWithRouter()
}
}
<!--suppress HtmlUnknownTarget -->
<html lang="en">
<head>
<meta name="viewport" content="width=device-width initial-scale=1 user-scalable=no" />
<title>SomeTitle</title>
<body>
<div id="app"></div>
<script type="text/javascript" src="<packageNameGoesHere!!!!!>.js"></script>
</body>
</html>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
React Router failed prop 'history', is undefined - Stack Overflow
What I noticed was that hashHistory doesn't exist in the react-router module, but rather there is a createBrowserHistory inside the history ...
Read more >hashHistory stopped working in 4.0.0 · Issue #4752 - GitHub
Warning: Failed prop type: The prop `history` is marked as required in `Router`, but its value is `undefined`. in Router printWarning ...
Read more >errorElement v6.5.0 - React Router
Put an errorElement at the top of your route tree and handle nearly every error in your app in one place. Or, put...
Read more >Cannot read properties of undefined (reading 'pathname')
The error "Cannot read properties of undefined (reading 'pathname')" occurs when we don't set the to prop on a Link component in React...
Read more >Ultimate React Router v6 Guide
This library specifically installs the DOM version of React Router. If you are using React Native you will need to install react-router-native ...
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
@subroh0508 will you take a look please? This is caused by #309
Yes i can confirm
5.1.2-pre.107-kotlin-1.3.72
.108
and109
do not work. There i get the following issue: https://github.com/JetBrains/kotlin-wrappers/issues/291 and after applying the mentioned workaround i get the issue i described here.