Migrating from Dioxus to Tairitsu
This guide helps you migrate applications from Dioxus to Tairitsu. Tairitsu is a WebAssembly Component Model framework that provides similar functionality to Dioxus but with a different architecture and API.
Table of Contents
- Architecture Comparison
- Environment Setup
- API Reference
- Router
- State Management
- Events
- Component Migration
- Hooks Reference
- Event System Differences
- Minimal Working Example
- Common Migration Patterns
Architecture Comparison
Dioxus Architecture
mermaid
- RSX Macro: Compile-time JSX-like syntax
- Props: Struct-based component properties
- Hooks: use_hook, use_state, use_effect
- Scheduler: Internal fiber-like reconciliation
- Renderer: Platform-specific renderers
Tairitsu Architecture
mermaid
- rsx! Macro: Declarative UI construction with similar syntax
- Props: Builder pattern with #[component] attribute
- Reactive: Signal/Effect-based reactivity
- Platform Trait: Abstract DOM operations
- Dual Backend: WebPlatform (web-sys) and WitPlatform (WIT bindings)
Environment Setup
Dioxus Setup
toml
1
2
3
[dependencies]
dioxus = "0.5"
dioxus-web = "0.5"
Tairitsu Setup
toml
1
2
3
4
5
6
7
[dependencies]
tairitsu-vdom = { path = "../../../packages/vdom" }
tairitsu-macros = { path = "../../../packages/macros" }
tairitsu-web = { path = "../../../packages/web", features = ["wit-bindings"] }
[lib]
crate-type = ["cdylib", "rlib"]
Target Differences
| Aspect | Dioxus | Tairitsu |
|---|---|---|
| Target | wasm32-unknown-unknown | wasm32-wasip2 |
| Bindings | wasm-bindgen | wit-bindgen |
| Model | Plain WASM | Component Model |
Build Commands
bash
1
2
3
4
5
6
7
# Dioxus
# Tairitsu
# or
API Reference
Router
Dioxus Router
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use *;
use *;
Tairitsu Router
Tairitsu does not include a built-in router. You need to implement routing yourself:
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use ;
State Management
Dioxus State
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Tairitsu State
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use ;
Events
Dioxus Events
rust
1
2
3
4
5
6
7
8
9
10
11
Tairitsu Events
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use component;
use ;
Component Migration
Dioxus Component
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Tairitsu Component
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use component;
use ;
Props Comparison
| Dioxus | Tairitsu |
|---|---|
| #[props(default)] | #[default] |
| #[props(!optional)] | No marker (required) |
| #[props(children)] | #[children] |
| clone on props | Auto-generated builder |
Hooks Reference
use_state -> Signal
rust
1
2
3
4
5
6
7
8
// Dioxus
let mut count = use_signal;
count.set;
// Tairitsu
let count = new;
let c = count.get;
count.set;
use_effect -> create_effect
rust
1
2
3
4
5
6
7
8
9
10
// Dioxus
use_effect;
// Tairitsu
create_effect;
use_memo -> Signal with derive
rust
1
2
3
4
5
6
7
8
9
10
11
// Dioxus
let doubled = use_memo;
// Tairitsu - manually computed
let doubled = ;
use_resource -> Manual async
Tairitsu does not have built-in resource management. You need to implement async patterns manually.
use_coroutine -> Manual channels
Tairitsu does not have built-in coroutine support. Use channels for async communication.
Event System Differences
Event Type Mapping
| Dioxus Event | Tairitsu Event |
|---|---|
| MouseEvent | MouseEvent |
| KeyboardEvent | KeyboardEvent |
| InputEvent | InputEvent |
| FocusEvent | FocusEvent |
| FormData | ChangeEvent |
Event Handler Differences
rust
1
2
3
4
5
6
7
8
9
10
11
12
// Dioxus
onclick: move |e: MouseEvent|
// Tairitsu
onclick: move |e: |
Event Modifiers
Dioxus supports event modifiers like prevent_default, stop_propagation. In Tairitsu, these are called on the event object:
rust
1
2
3
4
5
6
7
8
9
10
11
// Dioxus
onclick: move |e: MouseEvent|
// Tairitsu
onclick: move |e: |
Minimal Working Example
Dioxus Minimal Example
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use *;
Tairitsu Minimal Example
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
use ;
use rsx;
pub extern "C"
Cargo.toml for Tairitsu
toml
1
2
3
4
5
6
7
8
9
10
11
12
13
[package]
name = "my-tairitsu-app"
version = "0.1.0"
edition = "2024"
[dependencies]
tairitsu-vdom = { path = "../../../packages/vdom" }
tairitsu-macros = { path = "../../../packages/macros" }
tairitsu-web = { path = "../../../packages/web", features = ["wit-bindings"] }
anyhow = "1.0"
[lib]
crate-type = ["cdylib", "rlib"]
Common Migration Patterns
Conditional Rendering
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Dioxus
render!
// Tairitsu
rsx!
List Rendering
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Dioxus
let items = vec
!;
render!
// Tairitsu
let items = vec
!;
let list_items: = items
.iter
.map
.collect;
rsx!
Class Conditional
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Dioxus
render!
// Tairitsu - using Classes builder
use Classes;
let class = new
.add
.add_if;
rsx!
Style Conditional
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Dioxus
render!
// Tairitsu - using Style builder
use Style;
let style = new
.add
.add;
rsx!
Attribute Spreading
rust
1
2
3
4
5
6
7
8
9
10
11
12
13
// Dioxus
render!
// Tairitsu
rsx!