feat: add an unhygenic render macro (#556)

* feat: add an unhygenic render macro

* chore: use render instead of rsx!(cx,
This commit is contained in:
Jon Kelley authored and GitHub committed 2022-09-25 01:05:16 -07:00
1 parent 0c48cb3601
commit 28fba42e7e
28 files changed
+158 -163

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ impl BubbleState {
/// # Example
/// ```rust, ignore
/// fn App(cx: Scope) -> Element {
/// rsx!(cx, div {
/// render!(div {
/// onclick: move |_| println!("Clicked!")
/// })
/// }
+5 -5
View File
@@ -528,7 +528,7 @@ impl ScopeState {
///
/// ```rust, ignore
/// fn App(cx: Scope) -> Element {
/// rsx!(cx, div { "Subtree {id}"})
/// render!(div { "Subtree {id}"})
/// };
/// ```
///
@@ -659,12 +659,12 @@ impl ScopeState {
///
/// static App: Component = |cx| {
/// cx.use_hook(|| cx.provide_context(SharedState("world")));
/// rsx!(cx, Child {})
/// render!(Child {})
/// }
///
/// static Child: Component = |cx| {
/// let state = cx.consume_state::<SharedState>();
/// rsx!(cx, div { "hello {state.0}" })
/// render!(div { "hello {state.0}" })
/// }
/// ```
pub fn provide_context<T: 'static + Clone>(&self, value: T) -> T {
@@ -685,12 +685,12 @@ impl ScopeState {
///
/// static App: Component = |cx| {
/// cx.use_hook(|| cx.provide_root_context(SharedState("world")));
/// rsx!(cx, Child {})
/// render!(Child {})
/// }
///
/// static Child: Component = |cx| {
/// let state = cx.consume_state::<SharedState>();
/// rsx!(cx, div { "hello {state.0}" })
/// render!(div { "hello {state.0}" })
/// }
/// ```
pub fn provide_root_context<T: 'static + Clone>(&self, value: T) -> T {
+4 -4
View File
@@ -597,7 +597,7 @@ impl VirtualDom {
///
/// ```rust, ignore
/// fn Base(cx: Scope) -> Element {
/// rsx!(cx, div {})
/// render!(div {})
/// }
///
/// let dom = VirtualDom::new(Base);
@@ -617,7 +617,7 @@ impl VirtualDom {
///
/// ```rust, ignore
/// fn Base(cx: Scope) -> Element {
/// rsx!(cx, div {})
/// render!(div {})
/// }
///
/// let dom = VirtualDom::new(Base);
@@ -639,7 +639,7 @@ impl VirtualDom {
///
/// ```rust, ignore
/// fn Base(cx: Scope) -> Element {
/// rsx!(cx, div {})
/// render!(div {})
/// }
///
/// let dom = VirtualDom::new(Base);
@@ -662,7 +662,7 @@ impl VirtualDom {
///
/// ```rust, ignore
/// fn Base(cx: Scope) -> Element {
/// rsx!(cx, div {})
/// render!(div {})
/// }
///
/// let dom = VirtualDom::new(Base);