percy
percy copied to clipboard
Allow Support for multiple parameters in `JSX` syntax
The Problem
-
An error is thrown whenever I try to use pass in more than 1 argument to a "component" using the
<Component />
syntax. -
This is the component
-
This is the error thrown
-
The only alternative is to render the component like this:
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
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?
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
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
Awesome!