-
-
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
[docs] Add a next.js demo with hooks #13920
Conversation
Thanks for that!!! What's the significance of // Use the same helper as Babel to avoid bundle bloat.
import { install } from '@material-ui/styles';
install(); Tried to remove Also, I converted this example into typescript. Let me know if you would like a PR. |
@virzak The |
d465d9d
to
72b1720
Compare
I can only speak for myself, but any time I get a sample of a base library, I convert it to typescript. There is a lot of code in next.js (most notably _document.tsx and _app.tsx) which is not covered by the create-react-app example. Also I just find that typescript forces you to produce cleaner code. Here is the repo: https://github.com/virzak/material-ui-nextjs-hooks-typescript Added:
Issues:
|
So what you're saying is Also does the import order matter? ts-lint wants all imports sorted alphabetically. |
We could merge the example from @virzak into the main repo no objection here if he wants to work on that. Glanced over the repo quickly and it looked fine to me with some minor issues. |
@virzak It looks like we have a green light for this TypeScript demo :) 💚 . |
@@ -0,0 +1,40 @@ | |||
/* eslint-disable jsx-a11y/anchor-is-valid */ | |||
import '../src/bootstrap'; |
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 shouldn't be necessary from my understanding since we import this already in _app.js
and _app.js
is executed on client and server.
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.
Console log the execution order between the client and the server, it's different. We need to call it first. At least, until v4 is out.
Closes #13773