-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
displayName
options
useStyles
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 seeMuiTableCell
thanForwardRef(TableCell)
cc @eps1lon