Decisiv / styled-components-modifiers

A library to enable BEM flavored modifiers (and responsive modifiers) in styled components.
MIT License
297 stars 11 forks source link

I want to pass props to Elements from Blocks without explicitly passing them #69

Open umerjaved178 opened 2 years ago

umerjaved178 commented 2 years ago

I am using react with the following functional approach

` const Divider: React.FunctionComponent = ({children}) => (

// I want to use color props here of Card divider {children}

);

const Card: React.FunctionComponent = ({children, color}) => { const color = props.color

return(

card {children}

)}

Card.Divider = Divider; `

and I call these components as following

`

Any text ` **The problem is: How can I get the color props in the Divider component** PS: I don't want to repeat props passing again for divider like following ` Any text ` What I want is the following approach and can still able to use color props in Divider component, how can I do that ` Any text `
umerjaved178 commented 2 years ago

Github is having some errors whole displaying a block of code, you can see the issue here https://stackoverflow.com/questions/71758307/how-can-i-pass-props-to-inner-react-component-using-functional-approach