I'm updating Kotlin/JS code in <https://github.com...
# javascript
j
I'm updating Kotlin/JS code in https://github.com/joreilly/BikeShare/blob/master/web/src/main/kotlin/App.kt to start using
kotlin-react-router-dom
wrapper ....it looks like correct property gets passed to
StationList
but
useEffectWithCleanup
block isn't being executed 2nd time I click on a link (so isn't loading the data)....anyone know what I should be doing differently here?
ok, looks like I was running in to something like following (this was for "pure" React but seems like same param was cause as well for Kotlin/JS + react wrapper) https://stackoverflow.com/questions/60290004/reactjs-useeffect-is-not-run-when-the-url-changes
not sure exactly why but I had
Copy code
useEffectWithCleanup(dependencies = listOf())
if I change to following then it's run the 2nd time
Copy code
useEffectWithCleanup
t
null
- always •
emtyList()
- once •
listOf(x, y)
- when
x
or
y
changed https://reactjs.org/docs/hooks-effect.html
👍 1