yew/packages/yew-macro/tests/hook_macro/use_transitive_state-fail.rs
Kaede Hoshikawa b29b4535b7
use_prepared_state & use_transitive_state (#2650)
* Some initial implementation.

* Read prepared state during hydration.

* Decode each state with bincode.

* Feature gate prepared state.

* Update documentation.

* Switch from base64 to String.

* cargo +nightly fmt.

* Fix test.

* Add some tests.

* Minor adjustments.

* Remove unused marker.

* Update example.

* Add use_transitive_state.

* Remove unused dead code notation.

* Opt for better code size.

* Add tests for use_transitive_state.

* Fix cargo fmt.

* Fix rustdoc.

* Asynchronously decode data during hydration.

* Fix feature flags.

* Fix docs.

* Feature flags on ssr_router.

* Adjust workflow to reflect feature flags.

* Fix features.

* Restore wasm-bindgen-futures to be wasm32 only.

* Revert wasm-bindgen-futures.

* Second attempt to remove wasm-bindgen-futures.

* Remove spaces as well.

* Address reviews.

* Better diagnostic message.

* Update diagnostic messages.
2022-05-24 13:35:16 +09:00

27 lines
639 B
Rust

use yew::prelude::*;
use yew_macro::{use_transitive_state_with_closure, use_transitive_state_without_closure};
#[function_component]
fn Comp() -> HtmlResult {
use_transitive_state_with_closure!(123)?;
use_transitive_state_with_closure!(|_| { todo!() }, 123)?;
use_transitive_state_with_closure!(|_| -> u32 { todo!() })?;
Ok(Html::default())
}
#[function_component]
fn Comp2() -> HtmlResult {
use_transitive_state_without_closure!(123)?;
use_transitive_state_without_closure!(|_| { todo!() }, 123)?;
use_transitive_state_without_closure!(|_| -> u32 { todo!() })?;
Ok(Html::default())
}
fn main() {}