https://github.com/tkr-sh/modx
A way to handle states with structs in Dioxus
https://github.com/tkr-sh/modx
dioxus frontend rust state-management wasm
Last synced: 3 months ago
JSON representation
A way to handle states with structs in Dioxus
- Host: GitHub
- URL: https://github.com/tkr-sh/modx
- Owner: tkr-sh
- License: lgpl-3.0
- Created: 2024-04-07T14:59:58.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-12T10:41:27.000Z (about 1 year ago)
- Last Synced: 2025-09-04T23:57:32.230Z (10 months ago)
- Topics: dioxus, frontend, rust, state-management, wasm
- Language: Rust
- Homepage: https://docs.rs/modx
- Size: 284 KB
- Stars: 28
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
modx
[modx](https://github.com/tkr-sh/modx) is an experimental way to handle states with structs in [Dioxus](https://dioxuslabs.com/) inspired by [mobx](https://mobx.js.org/README.html).
## Example
```rs
#[modx::store]
struct CounterStore {
count: i64,
}
impl CounterStore {
fn inc(&mut self) {
self.count += 1;
}
fn dec(&mut self) {
self.count -= 1;
}
}
fn app() -> Element {
let mut store = CounterStore::new();
rsx! {
button { onclick: move |_| store.inc(), "+1" }
button { onclick: move |_| store.dec(), "-1" }
"{store.count}"
}
}
```
## Documentation
Documentation can be found at https://docs.rs/modx
## More examples
There are some examples at `~/examples` so you can see how to use `modx` and how it behaves.
You can run an example with:
```sh
cargo run --example this_example
```
with `this_example` being the name of the file (without the extension)
## Development progress
In the near future, most of the hooks should be rewrote to work with modx.
Here is the current status:
- [X] Signals
- [X] Props
- [X] Resources
- [ ] Memo
- [ ] Server future