[Table] Use makeStyles over withStyles - #15023
Conversation
6a643eb to
b183af8
Compare
a77e578 to
4887ebb
Compare
|
@material-ui/core: parsed: +0.25% , gzip: +0.57% Details of bundle changes.Comparing: 3a8f79a...3946bb4
|
209795c to
e152271
Compare
eps1lon
left a comment
There was a problem hiding this comment.
Ideally, I would rather see MuiTableCell than ForwardRef(TableCell) cc @eps1lon
Agreed. We can probably gather this into a single helper that sets the appropriate statics. Right now this could include:
displayNameoptionsuseStyles
@eps1lon It's a great idea. For the default props issue. What do you think of duplicating the information? Once in the props destructuring for React and once in this helper for the generation of the documentation? |
Should be good enough as a temporary solution. Seems like a good time to write a custom |
4bd7809 to
d701eb0
Compare
|
@eps1lon Updated. What do you think of the solution? |
| @@ -0,0 +1,14 @@ | |||
| export default function muiComponent(useStyles, Component) { | |||
There was a problem hiding this comment.
I guess it makes more sense to use the component as the first parameter. useStyles is more likely to get removed at some point than Component
There was a problem hiding this comment.
I can't. If I swap the arguments, react-docgen does no longer "see" the component in the file.
There was a problem hiding this comment.
This should be addressed in reactjs/react-docgen#343
d701eb0 to
69734c2
Compare
a1896d7 to
f4b0d4d
Compare
|
If using function components, just pass in props with arguments .. function MuiDiv({someKey=someValue, ...props}){} |
|
displayName over rides forwardRef in devtools btw |
We try not to destructure early #15344 (comment) |
|
I'm closing. To revisit in the future. |
This effort is related to #10778. I have benchmarked the following (in production mode):
Performance client-side (+15%)
Performance server-side (+10%)
DX (-1 component noise)
Before

After

Ideally, I would rather seeMuiTableCellthanForwardRef(TableCell)cc @eps1lon