wip: example

This commit is contained in:
Jonathan Kelley committed 2021-07-01 16:03:27 -04:00
1 parent 952a91d540
commit eb39b000d7
3 files changed
+56 -10

No files matched your search

+24
View File
@@ -3,3 +3,27 @@
Most of these examples are run through webview so you don't need the dioxus cli installed to preview the functionality. Anything labeled `_web` will need to be built with the Dioxus CLI to preview features that only a native bundle can handle.
List of examples:
| Example | What it does |
| --------------------------------------- | ------------ |
| [The basics](./basics.rs) | this does |
| [fine grained reactivity](./signals.rs) | this does |
| Global State Management | this does |
| Virtual Refs | this does |
| Inline Styles | this does |
| Conditional Rendering | this does |
| Maps/Iterators | this does |
| Render To string | this does |
| Component Children | this does |
| Function Driven children | this does |
| Memoization | this does |
| Borrowed Data | this does |
| Fragments | this does |
| Null/None Components | this does |
| Spread Pattern for props | this does |
| Controlled Inputs | this does |
| Custom Elements | this does |
| Testing And debugging | this does |
| Asynchronous Data | this does |
| Fiber/Scheduled Rendering | this does |
| CSS Compiled Styles | this does |
+26
View File
@@ -0,0 +1,26 @@
//! A Showcase of all the useful examples
//!
//!
//!
fn main() {
use_css_consumer(&cx, "mystyle");
// at the global head of the app
use_css_provider(&cx, |cfg| {});
use_recoil_provider(&cx, |cfg| {});
let recoil = use_recoil_api(&cx, |_| {});
use_websocket_connection(&cx, move |cfg| {
cfg.on_receive(move |event| match event.data::<Msg>() {
Ok(msg) => match msg {
a => recoil.set(&ATOM, 10),
c => recoil.set(&ATOM, 20),
_ => {}
},
Err(e) => {}
});
cfg.on_close(move |event| {});
cfg.on_open(move |event| {});
});
}