typeProps= {//classes?: { foo?: string; bar?: string; }; classes?:Partial<ReturnType<typeof useStyles>["classes"]>;};functionMyComponent(props:Props) {const { classes } =useStyles({ classesOverrides:props.classes });return ( <divclassName={classes.foo}> <spanclassName={classes.bar}> The background should be green, the box should have a dotted border and the text should be pink </span> </div> );}constuseStyles=tss.create({ foo: { border:"3px dotted black", backgroundColor:"red" } bar: { color:"pink" }});//...render( <MyTestComponentForMergedClassesInternalclasses={{ "foo":css({ "backgroundColor":"green" }) }} />);
typeProps= {//classes?: { foo?: string; bar?: string; }; classes?:Partial<ReturnType<typeof useStyles>["classes"]>;};functionMyTestComponentForMergedClassesInternal(props:Props) {const { classes } =useStyles({ "color":"pink" }, { props });//NOTE: Only the classes will be read from props, //you could write { props: { classes: props.classes } } instead of { propsΒ }//and it would work the same. return ( <divclassName={classes.foo}> <spanclassName={classes.bar}> The background should be green, the box should have a dotted border and the text should be pink </span> </div> );}constuseStyles=makeStyles<{ color:string; }>()({ foo: { border:"3px dotted black", backgroundColor:"red" } bar: { color }});//...render( <MyTestComponentForMergedClassesInternalclasses={{ "foo":css({ "backgroundColor":"green" }) }} />);