You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using React, imagine I hace a shared component that is a button:
constuseButtonStyles=createUseStyles({button: {background: 'blue'}})constButton=()=>{constclasses=useButtonStyles()return(<buttonclassName={classes.button}onClick={()=>alert('You clicked the button)}>Button</button>
)
Now, suppose that I would like to add a "styles" prop to the button, so that I can modify the "classes.button" class, not completely overriding it but composing. Something like this:
Is this correct? I am not sure and have the feeling that there is a specific way to achieve this. The problem I hace is that I end ap with a function un all classes I create and I want to add this flexible overriding. Thanks in advance.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Using React, imagine I hace a shared component that is a button:
Now, suppose that I would like to add a "styles" prop to the button, so that I can modify the "classes.button" class, not completely overriding it but composing. Something like this:
Is this correct? I am not sure and have the feeling that there is a specific way to achieve this. The problem I hace is that I end ap with a function un all classes I create and I want to add this flexible overriding. Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions