-
-
Notifications
You must be signed in to change notification settings - Fork 232
Closed
Description
Versions
- scalajs-react version:
3.0.0-beta12 - react version:
19.0.0
Bug
Not sure if this is the intended behavior (I searched the official React docs but couldn't see any mention of this behavior)
.useEffectOnMount doesn't work when used in conjunction with the .withPropsChildren hook.
Here's a minimal reproducible example
object Bug extends App {
val component = ScalaFnComponent
.withHooks[Unit]
.withPropsChildren
.useEffectOnMount {
Callback.log("useEffectOnMount not fired!") // won't run ...
}
.render(_.propsChildren)
ReactDOMClient
.createRoot(document.querySelector("#app"))
.render(component(<.div("hi there")))
}If we remove the .withPropsChildren hook instead the effect runs
object NoBug extends App {
val component = ScalaFnComponent
.withHooks[Unit]
.useEffectOnMount {
Callback.log("useEffectOnMount is fired!") // will run
}
.render(_ => <.div("hi there"))
ReactDOMClient
.createRoot(document.querySelector("#app"))
.render(component())
}Metadata
Metadata
Assignees
Labels
No labels