From 3238bb58ede9a9f6546058b2f8c178b024bfcaad Mon Sep 17 00:00:00 2001 From: thomas Date: Thu, 5 Oct 2023 13:54:22 +0200 Subject: [PATCH] Change the #[function_component] macro to #[component] by default --- .../communication_grandchild_with_grandparent/src/main.rs | 4 ++-- packages/yew-macro/src/function_component.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/communication_grandchild_with_grandparent/src/main.rs b/examples/communication_grandchild_with_grandparent/src/main.rs index 7397ad07dca..9dfadae22e1 100644 --- a/examples/communication_grandchild_with_grandparent/src/main.rs +++ b/examples/communication_grandchild_with_grandparent/src/main.rs @@ -9,8 +9,8 @@ mod grandparent; mod parent; use yew::{ - component, html, AttrValue, Callback, Component, Context, ContextHandle, - ContextProvider, Html, Properties, + component, html, AttrValue, Callback, Component, Context, ContextHandle, ContextProvider, Html, + Properties, }; /// This is the shared state between the parent and child components. diff --git a/packages/yew-macro/src/function_component.rs b/packages/yew-macro/src/function_component.rs index 9bf73d4a484..7bce7664725 100644 --- a/packages/yew-macro/src/function_component.rs +++ b/packages/yew-macro/src/function_component.rs @@ -35,7 +35,8 @@ impl Parse for FunctionComponent { item => { return Err(syn::Error::new_spanned( item, - "the `component` or `function_component` attribute can only be applied to functions", + "the `component` or `function_component` attribute can only be applied to \ + functions", )) } };