You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposing that we add a renderInRoot helper function to make this common pattern easier:
importReact.Basic.Util (renderInRoot)
myComponent::Component {}
myComponent = do
component "MyComponentName" \_ ->React.do-- ...main::EffectUnit
main = renderInRoot $ myComponent {}
A slightly more verbose option is:
importReact.Basic.Util (createRootElement)
mkMyComponent::Component {}
mkMyComponent = do
component "MyComponentName" \_ ->React.do-- ...main::EffectUnit
main = do
root <- createRootElement
myComponent <- mkMyComponent
render (myComponent {}) root
We could support both options, and reuse createRootElement in renderInRoot.
For context, Halogen has some convenient helper functions for launching components, such as awaitBody in Halogen.Aff.Util:
hookComponent = Hooks.component \_ _ ->Hooks.do-- ...main::EffectUnit
main =
HA.runHalogenAff do
body <-HA.awaitBody
void $ runUI hookComponent Nothing body
The text was updated successfully, but these errors were encountered:
Proposing that we add a
renderInRoot
helper function to make this common pattern easier:A slightly more verbose option is:
We could support both options, and reuse
createRootElement
inrenderInRoot
.For context, Halogen has some convenient helper functions for launching components, such as
awaitBody
in Halogen.Aff.Util:The text was updated successfully, but these errors were encountered: