Skip to content
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 Support for multiple parameters in JSX syntax #181

Open
AkinAguda opened this issue Jun 18, 2022 · 4 comments
Open

Allow Support for multiple parameters in JSX syntax #181

AkinAguda opened this issue Jun 18, 2022 · 4 comments

Comments

@AkinAguda
Copy link
Contributor

The Problem

  • An error is thrown whenever I try to use pass in more than 1 argument to a "component" using the <Component /> syntax.

Screenshot 2022-06-18 at 11 02 54

  • This is the component

Screenshot 2022-06-18 at 11 02 37

  • This is the error thrown

Screenshot 2022-06-18 at 11 11 11

  • The only alternative is to render the component like this:

Screenshot 2022-06-18 at 11 12 28

Suggestion

It would be nice if we could allow support for multiple arguments in the JSX syntax as well

<Range
  min={1}
  max={10}
 />

Or let me know if there is a particular reason for this.
Thanks

@chinedufn
Copy link
Owner

I was actually planning to remove support for <Component field1={..} field2={..} /> syntax.

I'm trying to, as much as possible, only have one way to do things.

And only in cases where it's very convenient would we add a shortcut / additional way.

Curious about your thoughts, if any?

@AkinAguda
Copy link
Contributor Author

AkinAguda commented Jun 25, 2022

Oh I see. I'd suggest to keep the <Component field1={..} field2={..} /> syntax in. This is especially nice to use when using it among other html elements (It fits in nicely). As opposed to writing a function call that return html!

Honestly, I can't think of any reason but it's syntactical advantages. It's more friendly for web developers as well since its pretty much a convention used in other popular web frameworks.

Also, does that mean are you removing Structs as components? @chinedufn

@chinedufn
Copy link
Owner

Definitely keeping the View trait, so structs as components are here to stay.

As for the shorthand syntax.. Ok let's continue to support it for now. I'm not so sure about my own stance yet.

Also, just for context, the feature was introduced here #139


Cool.. we can support this.. at least for the time being until we get feedback from others

@AkinAguda
Copy link
Contributor Author

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants