Fission for Dioxus developers
Rust types and component composition already provide a common starting point.
The important difference is what the component describes. Fission Compose
constructs retained widgets for Fission's layout, semantics and rendering
pipeline; it does not construct a virtual DOM.
This page maps responsibilities rather than claim every signal or RSX pattern
has a spelling-equivalent replacement. Use
the complete task app for the
runnable version, normal module boundaries and interactive preview. The state ownership rule
A signal says that a value can change; it does not by itself decide which
part of the product should own that value. Make that decision first in Fission.
props holds parent inputs.
Component state holds retained UI memory.
GlobalState holds shared product facts.
reduce changes state, while effects/jobs/resources perform outside work.
Env holds theme, locale and host context.
A database or service remains the persistent authority when the app uses one.
A GlobalState field is not automatically saved across launches.
1. Static UI
An RSX component receives props. A Compose component declares typed props too,
but its view returns ordinary Fission widgets:
use fission::prelude::*;
fission_component! {
pub TaskHeading<()> {
props { title: String }
}
view(heading, _state, cx) {
let tokens = &cx.view.env().theme.tokens;
} =>
Text(heading.title.clone()).size(tokens.typography.heading1_size)
}
The parent supplies translated text. Built-in, custom and third-party widget
names all resolve through normal Rust imports; there is no second catalogue
which a widget author must register with.
2. Product state and interaction
An expanded explanation is local memory, unlike the task record itself:
fission_component! {
pub TaskExplanation<()> {
props {
title: String,
explanation: String,
}
state { expanded: bool = false }
}
view(task, _state, cx) {
let tokens = &cx.view.env().theme.tokens;
} =>
Column(
gap: tokens.spacing.s,
children: [
Button(
child: Text(task.title.clone()),
key: "toggle-explanation",
on_press: reduce { task.expanded = !task.expanded; },
),
if task.expanded {
Text(task.explanation.clone())
},
],
)
}
Compose generates retained local-state wiring from state. If repeated task
cards use this component, give each call its durable key: task.id so a reorder
does not move the expanded state to another task.
For an actual task edit, resolve the current record in GlobalState from that
ID inside the reducer. Do not move a borrowed iterator row into a later event,
and do not mutate a prop snapshot as though it were the authoritative record.
3. Outside work
Dioxus resources provide a useful mental model for a value which can be
loading, ready or failed. Preserve those states in Fission rather than hide a
future in the render path.
For initial app data, use a startup action and an app-owned job or resource.
For component-owned user actions, on_press: effect operation(...) calls a
#[fission_effect] async function with owned snapshots and handles on_ok and
on_err. on_start is optional; the two result paths are not.
A completion handler sees current component/app state. The async function
does not receive live state or cx. Component-owned completion is ignored
after unmount, so choose an app-owned lifetime when the request must survive
leaving the screen. Compose and
Resources and async show both boundaries. Display Spinner while waiting and a recoverable Alert on failure. When a
load could overwrite a newer edit, disable that edit or compare an operation
generation before applying the result.
4. Styling and theme
A CSS class targets browser styling. Fission's design system is typed runtime
environment data which the active shell can lower. Read
cx.view.env().theme.tokens in the setup block, use token spacing and
typography, and prefer a built-in widget recipe over hand-built chrome.
Use Card for a real content surface, FormControl for labels/validation and
Modal for a dialog. A tree of containers may look similar in one screenshot
while lack the focus and semantic behaviour those widgets already own.
Static site and SSR can produce HTML/CSS; Web can run the interactive browser
app. Choose the target from the required output rather than assume a native
shell is a web page with different window furniture.
5. Routing
A Dioxus routable enum is not a required shape for Fission. Use its native
Router with app-owned route state:
fission_component! {
pub TaskRoutes<TaskState>
view(_routes, state, _cx) =>
Router::<TaskState>::new()
.with_path(state.current_path.clone())
.route_component("/", TaskScreen)
.route_component("/tasks/:id", TaskDetailRoute)
}
This excerpt assumes the named components and a shell route handler which
keeps current_path synchronized. TaskDetailRoute reads RouteParams and
validates the ID. Unknown or malformed values get an explicit not-found path,
not a fabricated task zero.
6. Testing
Do not invent a test helper named app.find(...) merely because a browser test
would be convenient. Fission provides distinct real boundaries:
| |
|---|
| Pure transition/reducer test |
Widget output and semantic structure | |
Actual typing, focus, pointer input and screenshots | |
Target host or package behaviour | Live qualification on that target |
Give controls stable semantic identifiers, and follow
Write a live UI test for a complete
launch/readiness/cleanup example. Vocabulary map
| | |
|---|
| fission_component! and view(...) | Constructs retained widgets, not a virtual DOM. |
| Component state, GlobalState or a selected view | Ownership and lifetime determine storage. |
| Resource/job/service/effect | Choose the actual request lifetime. |
| | The shell adapts platform route changes. |
| | Platform hosting does not duplicate product behaviour. |
Common instincts to adjust
The named view(component, state, cx) scopes are not closure parameters which
can be captured into an async task. Let Compose bind event handlers and pass
owned values across an effect boundary.
Keep the useful multi-platform instinct. Verify input, accessibility and
packaging on the targets the product actually supports rather than infer them
from a successful Web preview.
What to read next