-
Couldn't load subscription status.
- Fork 1.3k
refactor useMedia to improve initialization #208
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
Conversation
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.
Thanks for this! Unfortunately this will break with server rendering so I'm going to keep the one we have. Thanks anyway!
hey kent! yeah this change will break with SSR - can I take a shot at it and fix it? I feel like initializing the state the way I did (when it is possible to) will be good UX.
Thanks, but I would like to keep things consistent with the videos as much as possible. Thanks anyway!
Refactored useMedia to enhance its usability, particularly for UI changes. Now, instead of setting an initial default value and waiting for useEffect to catch up, the matched result is obtained right away. This adjustment ensures a reliable response when utilizing useMedia in UI-related scenarios.