reflex-dom-nested-routing

Nested client-side routing for Reflex-DOM

BSD-3-CLAUSE License

Stars
11

Nested Routing for Reflex-DOM

Example:

app = runRouteWithPathInFragment $ do
  switchPromptly never <=< withRoute $ \route -> case fromMaybe "" route of
    ""         -> (["users"] <$) <$> buttonClick "Open users"
    "users"    -> users
    "test"     -> codeToRun >> pure never
    "settings" -> text "Settings" >> pure never
    _          -> redirectLocally []

RouteWriter can make plumbing easer:

app = runRouteWithPathInFragment $ fmap snd $ runRouteWriterT $ do
  void $ withRoute $ \route -> case fromMaybe "" route of
    ""         -> tellRouteAs ["users"] =<< buttonClick "Open users"
    "users"    -> users
    "test"     -> codeToRun
    "settings" -> text "Settings"
    _          -> tellRedirectLocally []
Badges
Extracted from project README
Haskell Programming Language BSD3 License