From d422a23c94c669d137c380031b53a938296bee7d Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Tue, 14 Jun 2022 09:55:46 -0500 Subject: [PATCH] add a chapter in the refrence --- docs/reference/src/SUMMARY.md | 1 + docs/reference/src/guide/hot_reloading.md | 24 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 docs/reference/src/guide/hot_reloading.md diff --git a/docs/reference/src/SUMMARY.md b/docs/reference/src/SUMMARY.md index 18f351bfa..3918268d3 100644 --- a/docs/reference/src/SUMMARY.md +++ b/docs/reference/src/SUMMARY.md @@ -21,6 +21,7 @@ - [Custom Renderer](guide/custom_renderer.md) - [Server-side components](guide/server_side_components.md) - [Bundling and Distributing](guide/bundline.md) + - [Hot Reloading Rsx](guide/hot_reloading.md) - [Reference Guide](reference/reference.md) - [Anti-patterns](reference/anti.md) diff --git a/docs/reference/src/guide/hot_reloading.md b/docs/reference/src/guide/hot_reloading.md new file mode 100644 index 000000000..eff0c8a54 --- /dev/null +++ b/docs/reference/src/guide/hot_reloading.md @@ -0,0 +1,24 @@ +# Hot Reloading +1. Hot reloading allows much faster iteration times inside of rsx calls by interperting them and streaming the edits. +2. It is useful when changing the styling/layout of a program, but will not help with changing the logic of a program. +3. Currently the cli only implements hot reloading for the web renderer. + +# Setup +Install [dioxus-cli](https://github.com/DioxusLabs/cli). +Enable the hot_reload feature on dioxus: +```toml +dioxus = { version = "*", features = ["web", "hot_reload"] } +``` + +# Usage +1. run: +``` +dioxus serve --hot-reload +``` +2. change some code within a rsx macro +3. open your localhost in a browser +4. save and watch the style change without recompiling + +# Limitations +1. The interperter can only use expressions that existed on the last full recompile. If you introduce a new variable or expression to the rsx call, it will trigger a full recompile to capture the expression. +2. Components and Iterators can contain abritary rust code, and will trigger a full recompile when changed. \ No newline at end of file