-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow function_component
creation based on function name
#2292
Conversation
Visit the preview URL for this PR (updated for commit aae1436): https://yew-rs--pr2292-enhance-fc-r0osy4ih.web.app (expires Thu, 30 Dec 2021 12:12:25 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good thanks!
Maybe Since the internal was never a function and this kind of justifies the non snake naming scheme of component names. I would prefer functions to have snake_case if it was marked as |
Cool Stuff! |
let component_name = component_name.unwrap_or_else(|| function_name.clone()); | ||
let function_name = format_ident!( | ||
"{}FunctionProvider", | ||
function_name, | ||
span = function_name.span() | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want to convert the function name to PascalCase with convert_case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't really matter since it's not in the public API. Besides, generally this name would be PascalCase anyway because that's the convention for component names.
Unfortunately, that's not possible. |
…2292) * function_component without name * fmt * fc * update docs * remove fc
…2292) * function_component without name * fmt * fc * update docs * remove fc
Description
This PR modifies the
function_component
macro to use the function name if no name is provided.Checklist
cargo make pr-flow