-
-
Notifications
You must be signed in to change notification settings - Fork 173
[core] refactor: useModernLayoutEffect => useLayoutEffect #1931
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
base: master
Are you sure you want to change the base?
Conversation
In my opinion, the |
commit: |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
We strictly enforce using React imports with
If we're really worried about that case, we should add an eslint rule to disable using that react import. Otherwise we're still relying on people not forgetting to use the right one instead of automatically reaching for I don't feel like those reasons aren't compelling enough for the increase in verbosity. The more characters there are on screen, the less the eye can focus on what actually matters. |
Code is read considerably more times than it is written, it feels preferable imo to optimize for readability rather than save 2 clicks when importing that hook. |
We could also consider the shorter |
I don't have strong opinion on either. |
I strongly prefer @atomiks Any other reason to prevent the change? The ambiguity is not applicable, and the import-DX feels less important than the reading-DX, so I don't see a strong reason to avoid the change. I can set up an eslint rule to prevent using I'll probably redo this PR on top of the separate utils package PR once it's merged. |
I don't feel that I read code more than I write it in this repo, at least currently. We're building a lot of new components. I feel like I'm always typing |
Following this discussion: https://mui-org.slack.com/archives/C011VC970AW/p1738093359898899
The "modern" token doesn't bring any useful semantic, and makes the codebase more verbose. I've also added jsdocs & typings in our re-export because somehow the typings and jump-to-definition don't work for the floating-ui package, so I had to manually find that function to find what it does.