dioxus/notes/Parity.md

47 lines
2 KiB
Markdown
Raw Normal View History

2021-05-26 15:22:44 +00:00
# Parity with React
2021-06-25 13:31:13 +00:00
Parity has moved to the homepage
## Required services:
---
2021-06-25 13:31:13 +00:00
Gloo is covering a lot of these. We want to build hooks around these and provide examples on how to use them.
https://github.com/rustwasm/gloo
2021-06-25 13:31:13 +00:00
For example, resize observer would function like this:
```rust
2021-09-21 17:42:52 +00:00
pub static Example: FC<()> = |cx, props|{
2021-06-25 13:31:13 +00:00
let observer = use_resize_observer();
cx.render(rsx!(
div { ref: observer.node_ref
"Size, x: {observer.x} y: {observer.y}"
}
))
}
```
However, resize observing is _not_ cross-platform, so this hook (internally) needs to abstract over the rendering platform.
For other services, we shell out to gloo. If the gloo service doesn't exist, then we need to contribute to the project to make sure it exists.
| Service | Hook examples | Current Projects |
| ---------------------------- | ------------- | ---------------- |
2021-07-16 20:11:25 +00:00
| Fetch | 👀 | Reqwest/surf |
| Local storage (cache) | 👀 | Gloo |
| Persistent storage (IndexDB) | 👀 | 👀 |
| WebSocket | 👀 | Gloo |
| 3D Renderer / WebGL | 👀 | Gloo |
| Web Worker | 👀 | 👀 |
| Router | 👀 | 👀 |
| Notifications | 👀 | 👀 |
| WebRTC Client | 👀 | 👀 |
| Service Workers | 👀 | 👀 |
| Resize Observer | 👀 | 👀 |
| Canvas | 👀 | 👀 |
| Clipboard | 👀 | 👀 |
| Fullscreen | 👀 | 👀 |
| History API | 👀 | 👀 |