Component Prop Spreading #2215
Replies: 3 comments
-
A) Prop spreadingThis option needs to manage our const ReactComponent = ({a, b c, ...props}) => {
const {classNames, styles, ...rest} = props
return (<tag a={a} b={b} c={c} {...rest} />)
}
const App = () => (
<ReactComponent a={0} b="b" c d={<D/>} aria-label="label" data-attribute="attribute" />
) |
Beta Was this translation helpful? Give feedback.
-
B)
|
Beta Was this translation helpful? Give feedback.
-
C)
|
Beta Was this translation helpful? Give feedback.
-
Coding an Adevinta react @sui-component
Current agreement:
– What
There is no agreement using prop spreading.
Currently we have an agreement for closing classNames string prop (do not concat) and never use style inline. However, we also commonly find closed props in many of our components. This is not a problem at all because we have the agreement we can iterate every single component to increase its functionality with extra props but if can be tough when adding props for every single html attribute like 'data' and 'aria' attributes.
The final decision will be part of our @SUI-Components agreements.
– How
– Why
We agree every Adevintan is a sui-components maintainer and our philosophy is to have a unique place to concentrate our repeated necessities all over our different brands. This repository concentrate the react-components of all of them. This suppose take decisions and keep in mind when coding in order to do not break any brand particularity.
Classname prop
Style prop
⬇⬇⬇
0 votes ·
Beta Was this translation helpful? Give feedback.
All reactions