chinedufn / percy

Build frontend browser apps with Rust + WebAssembly. Supports server side rendering.
https://chinedufn.github.io/percy/
Apache License 2.0
2.25k stars 84 forks source link

Allow Support for multiple parameters in `JSX` syntax #181

Open AkinAguda opened 2 years ago

AkinAguda commented 2 years ago

The Problem

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 https://github.com/chinedufn/percy/pull/139


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

AkinAguda commented 2 years ago

Awesome!