Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed
diaasaur wants to merge 1 commit into epicweb-dev:main from diaasaur:pr/refactor-useMedia

Conversation

@diaasaur
Copy link

@diaasaur diaasaur commented Jun 22, 2023

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.

Copy link
Member

@kentcdodds kentcdodds left a 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!

Copy link
Author

diaasaur commented Jun 22, 2023
edited
Loading

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.

Copy link
Member

Thanks, but I would like to keep things consistent with the videos as much as possible. Thanks anyway!

diaasaur reacted with thumbs up emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kentcdodds kentcdodds kentcdodds left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /