dx-utils
Utility functions for Dioxus fullstack apps.
Functions
redirect_external(url: &str)
Redirect to an external URL. Works correctly during both SSR and client-side navigation.
- During SSR: sets HTTP 302 status and a
Locationheader viaFullstackContext, producing a real HTTP redirect before any HTML reaches the browser. - On the client (post-hydration): uses
navigator().replace()withNavigationTarget::Externalfor a client-side navigation.
Usage
Add to your Cargo.toml:
[]
= "0.1"
[]
= ["dx-utils/server"]
Then in your component:
use *;
use redirect_external;
Features
| Feature | Description |
|---|---|
server |
Enables SSR redirect via FullstackContext and http crate |
Requirements
- Dioxus 0.7+
- Rust 1.75+
License
MIT